You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2012/12/06 22:43:38 UTC
svn commit: r1418094 [1/2] - in /incubator/jspwiki/trunk: ./
src/org/apache/wiki/ src/org/apache/wiki/forms/ src/org/apache/wiki/parser/
src/org/apache/wiki/plugin/ src/org/apache/wiki/tags/
src/org/apache/wiki/util/ tests/org/apache/wiki/plugin/
Author: juanpablo
Date: Thu Dec 6 21:43:33 2012
New Revision: 1418094
URL: http://svn.apache.org/viewvc?rev=1418094&view=rev
Log:
* 2.9.1-svn-3
* Added generics to WikiPlugin.execute( WikiContext, Map< String, String > )
and propagated the change to all plugins. Cfr. with UPGRADING document for details.
Modified:
incubator/jspwiki/trunk/ChangeLog
incubator/jspwiki/trunk/UPGRADING
incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormClose.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormElement.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInfo.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInput.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOpen.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOutput.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSelect.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSet.java
incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormTextarea.java
incubator/jspwiki/trunk/src/org/apache/wiki/parser/PluginContent.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/AbstractReferralPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/BugReportHandler.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Counter.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/CurrentTimePlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Denounce.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Groups.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IfPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Image.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IndexPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InitializablePlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InsertPage.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ListLocksPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Note.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PageViewPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ParserStagePlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PluginManager.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RPCSamplePlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RecentChangesPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferredPagesPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferringPagesPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Search.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/SessionsPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/TableOfContents.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UndefinedPagesPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UnusedPagesPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogArchivePlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogEntryPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WikiPlugin.java
incubator/jspwiki/trunk/src/org/apache/wiki/tags/PluginTag.java
incubator/jspwiki/trunk/src/org/apache/wiki/util/FormUtil.java
incubator/jspwiki/trunk/tests/org/apache/wiki/plugin/JavaScriptPlugin.java
Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Thu Dec 6 21:43:33 2012
@@ -1,3 +1,10 @@
+2012-12-06 Juan Pablo Santos (juanpablo AT apache DOT org)
+
+ * 2.9.1-svn-3
+
+ * Added generics to WikiPlugin.execute( WikiContext, Map< String, String > )
+ and propagated the change to all plugins. Cfr. with UPGRADING document for details.
+
2012-12-02 Harry Metske <me...@apache.org>
* 2.9.1-svn-2
Modified: incubator/jspwiki/trunk/UPGRADING
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/UPGRADING?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/UPGRADING (original)
+++ incubator/jspwiki/trunk/UPGRADING Thu Dec 6 21:43:33 2012
@@ -22,6 +22,21 @@ Apache JSPWiki 2.9.0-incubating - Upgrad
The license file can be found in LICENSE.
+
+Upgrading JSPWiki to 2.9.1
+--------------------------
+
+Beginning with JSPWiki-2.9.1-svn-3, generics have been added to WikiPlugin's execute() signature,
+which now looks like:
+
+String execute( WikiContext context, Map<String, String> params ) throws PluginException;
+
+Internally this Map was always constructed and expected to be used as <String, String>, except for
+the special _bounds parameter, which was constructed internally as an int[pos, end]. This parameter
+is built now as a String and has the form of "pos|end". Other than that, this change of signature
+shouldn't affect your custom plugins.
+
+
Upgrading JSPWiki from 2.8.x to 2.9.0
-------------------------------------
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/Release.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/Release.java Thu Dec 6 21:43:33 2012
@@ -64,7 +64,7 @@ public final class Release
public static final int REVISION = 9;
/** The minor revision. */
- public static final int MINORREVISION = 2;
+ public static final int MINORREVISION = 1;
/** The build number/identifier. This is a String as opposed to an integer, just
* so that people can add other identifiers to it. The build number is incremented
@@ -75,7 +75,7 @@ public final class Release
* <p>
* If the build identifier is empty, it is not added.
*/
- public static final String BUILD = "1";
+ public static final String BUILD = "3";
/**
* This is the generic version string you should use
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormClose.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormClose.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormClose.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormClose.java Thu Dec 6 21:43:33 2012
@@ -18,12 +18,13 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.wiki.WikiContext;
import org.apache.wiki.plugin.PluginException;
import org.apache.wiki.plugin.WikiPlugin;
-import java.util.*;
-
/**
* Closes a WikiForm.
*
@@ -37,7 +38,7 @@ public class FormClose
*
* {@inheritDoc}
*/
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
StringBuffer tags = new StringBuffer();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormElement.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormElement.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormElement.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormElement.java Thu Dec 6 21:43:33 2012
@@ -18,7 +18,7 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
+import org.apache.wiki.WikiContext;
import org.apache.wiki.plugin.WikiPlugin;
/**
@@ -61,7 +61,7 @@ public abstract class FormElement
/** Plugin parameter, mandatory in open/output: name of the form. */
public static final String PARAM_FORM = "form";
/** Plugin parameter, mandatory in input elements: name of an element. */
- public static final String PARAM_INPUTNAME = "name";
+ public static final String PARAM_INPUTNAME = "name";
/** Plugin parameter, optional: default value for an input. */
public static final String PARAM_VALUE = "value";
/** Experimental: hide the form if it was submitted successfully. */
@@ -101,6 +101,6 @@ public abstract class FormElement
*/
protected FormInfo getFormInfo( WikiContext ctx )
{
- return (FormInfo)ctx.getVariable( FORM_VALUES_CARRIER );
+ return ( FormInfo )ctx.getVariable( FORM_VALUES_CARRIER );
}
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInfo.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInfo.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInfo.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInfo.java Thu Dec 6 21:43:33 2012
@@ -48,7 +48,7 @@ public class FormInfo
private String m_handler;
private String m_result;
private String m_error;
- private Map<?, ?> m_submission;
+ private Map<String, String> m_submission;
/**
* Creates a new FormInfo with status == OK.
@@ -203,10 +203,9 @@ public class FormInfo
* Copies the given values into the handler parameter map using Map.putAll().
* @param val parameter name-value pairs for a Form handler WikiPlugin
*/
- @SuppressWarnings("unchecked")
- public void setSubmission( Map val )
+ public void setSubmission( Map< String, String > val )
{
- m_submission = new HashMap();
+ m_submission = new HashMap< String, String >();
m_submission.putAll( val );
}
@@ -214,11 +213,10 @@ public class FormInfo
* Adds the given values into the handler parameter map.
* @param val parameter name-value pairs for a Form handler WikiPlugin
*/
- @SuppressWarnings("unchecked")
- public void addSubmission( Map val )
+ public void addSubmission( Map< String, String > val )
{
if( m_submission == null )
- m_submission = new HashMap();
+ m_submission = new HashMap< String, String >();
m_submission.putAll( val );
}
@@ -230,7 +228,7 @@ public class FormInfo
*
* @return Handler parameter name-value pairs.
*/
- public Map getSubmission()
+ public Map< String, String > getSubmission()
{
return m_submission;
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInput.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInput.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInput.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormInput.java Thu Dec 6 21:43:33 2012
@@ -18,13 +18,15 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
-import org.apache.wiki.plugin.PluginException;
-import org.apache.wiki.plugin.WikiPlugin;
-
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
import org.apache.ecs.xhtml.input;
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.plugin.PluginException;
+import org.apache.wiki.plugin.WikiPlugin;
/**
* Creates a simple input text field.
@@ -43,13 +45,13 @@ public class FormInput
*
* {@inheritDoc}
*/
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
- String inputName = (String)params.get( PARAM_INPUTNAME );
- String inputValue = (String)params.get( PARAM_VALUE );
- String inputType = (String)params.get( PARAM_TYPE );
- String size = (String)params.get( PARAM_SIZE );
+ String inputName = params.get( PARAM_INPUTNAME );
+ String inputValue = params.get( PARAM_VALUE );
+ String inputType = params.get( PARAM_TYPE );
+ String size = params.get( PARAM_SIZE );
ResourceBundle rb = ctx.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
if( inputName == null )
@@ -59,7 +61,7 @@ public class FormInput
// Don't render if no error and error-only-rendering is on.
FormInfo info = getFormInfo( ctx );
- Map previousValues = null;
+ Map< String, String > previousValues = null;
if( info != null )
{
if( info.hide() )
@@ -71,7 +73,7 @@ public class FormInput
if( previousValues == null )
{
- previousValues = new HashMap();
+ previousValues = new HashMap< String, String >();
}
// In order to isolate posted form elements into their own
@@ -81,11 +83,11 @@ public class FormInput
HANDLERPARAM_PREFIX + inputName,
inputValue );
- String checked = (String)params.get("checked");
+ String checked = params.get("checked");
field.setChecked( TextUtil.isPositive(checked)
|| "checked".equalsIgnoreCase(checked) );
- String oldValue = (String)previousValues.get( inputName );
+ String oldValue = previousValues.get( inputName );
if( oldValue != null )
{
field.setValue( oldValue );
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOpen.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOpen.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOpen.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOpen.java Thu Dec 6 21:43:33 2012
@@ -74,23 +74,23 @@ public class FormOpen
/**
* {@inheritDoc}
*/
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
ResourceBundle rb = ctx.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
- String formName = (String)params.get( PARAM_FORM );
+ String formName = params.get( PARAM_FORM );
if( formName == null )
{
Object[] args = { PARAM_FORM };
throw new PluginException( MessageFormat.format( rb.getString( "formopen.missingparam" ), args ) );
}
- String hide = (String)params.get( PARAM_HIDEFORM );
+ String hide = params.get( PARAM_HIDEFORM );
String sourcePage = ctx.getPage().getName();
- String submitServlet = (String)params.get( PARAM_SUBMITHANDLER );
+ String submitServlet = params.get( PARAM_SUBMITHANDLER );
if( submitServlet == null )
submitServlet = ctx.getURL( WikiContext.VIEW, sourcePage );
- String method = (String)params.get( PARAM_METHOD );
+ String method = params.get( PARAM_METHOD );
if( method == null ) method="post";
if( !(method.equalsIgnoreCase("get") || method.equalsIgnoreCase("post")) )
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOutput.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOutput.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOutput.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormOutput.java Thu Dec 6 21:43:33 2012
@@ -53,8 +53,7 @@ public class FormOutput
* @return {@inheritDoc}
* @throws {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
//
@@ -70,9 +69,9 @@ public class FormOutput
// The submitted form MUST have parameter 'formname' equal to the name
// parameter of this Form plugin.
- String formName = (String)params.get( PARAM_FORM );
+ String formName = params.get( PARAM_FORM );
String submitForm = ctx.getHttpParameter( PARAM_FORMNAMEHIDDEN );
- String populator = (String)params.get( PARAM_POPULATE );
+ String populator = params.get( PARAM_POPULATE );
if( submitForm == null || formName == null ||
!formName.equals( submitForm ) )
@@ -86,7 +85,7 @@ public class FormOutput
// If population was allowed, we should first
}
- String handler = (String)params.get( PARAM_HANDLER );
+ String handler = params.get( PARAM_HANDLER );
if( handler == null || handler.length() == 0 )
{
Object[] args = { PARAM_HANDLER };
@@ -112,15 +111,15 @@ public class FormOutput
// Sift out all extra parameters, leaving only those submitted
// in the HTML FORM.
- Map handlerParams = FormUtil.requestToMap( ctx.getHttpRequest(),
- HANDLERPARAM_PREFIX );
+ Map< String, String > handlerParams = FormUtil.requestToMap( ctx.getHttpRequest(),
+ HANDLERPARAM_PREFIX );
// Previous submission info may be available from FormSet
// plugin - add, don't replace.
info.addSubmission( handlerParams );
// Pass the _body parameter from FormOutput on to the handler
- info.getSubmission().put(PluginManager.PARAM_BODY,
- params.get(PluginManager.PARAM_BODY));
+ info.getSubmission().put( PluginManager.PARAM_BODY,
+ params.get(PluginManager.PARAM_BODY));
String handlerOutput = null;
String error = null;
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSelect.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSelect.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSelect.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSelect.java Thu Dec 6 21:43:33 2012
@@ -18,15 +18,16 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
-import org.apache.wiki.plugin.PluginException;
-import org.apache.wiki.plugin.WikiPlugin;
-
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.xhtml.option;
import org.apache.ecs.xhtml.select;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.plugin.PluginException;
+import org.apache.wiki.plugin.WikiPlugin;
/**
* Creates a Form select field.
@@ -38,14 +39,14 @@ public class FormSelect
/**
* {@inheritDoc}
*/
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
// Don't render if no error and error-only-rendering is on.
FormInfo info = getFormInfo( ctx );
ResourceBundle rb = ctx.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
- Map previousValues = null;
+ Map< String, String > previousValues = null;
if( info != null )
{
@@ -58,7 +59,7 @@ public class FormSelect
if( previousValues == null )
{
- previousValues = new HashMap();
+ previousValues = new HashMap< String, String >();
}
ConcreteElement field = null;
@@ -76,34 +77,34 @@ public class FormSelect
/**
* Builds a Select element.
*/
- private select buildSelect( Map pluginParams, Map ctxValues, ResourceBundle rb )
+ private select buildSelect( Map< String, String > pluginParams, Map< String, String > ctxValues, ResourceBundle rb )
throws PluginException
{
- String inputName = (String)pluginParams.get( PARAM_INPUTNAME );
+ String inputName = pluginParams.get( PARAM_INPUTNAME );
if( inputName == null )
{
throw new PluginException( rb.getString( "formselect.namemissing" ) );
}
- String inputValue = (String)pluginParams.get( PARAM_VALUE );
- String previousValue = (String)ctxValues.get( inputName );
+ String inputValue = pluginParams.get( PARAM_VALUE );
+ String previousValue = ctxValues.get( inputName );
//
// We provide several ways to override the separator, in case
// some input application the default value.
//
- String optionSeparator = (String)pluginParams.get( "separator" );
+ String optionSeparator = pluginParams.get( "separator" );
if( optionSeparator == null )
- optionSeparator = (String)ctxValues.get( "separator." + inputName);
+ optionSeparator = ctxValues.get( "separator." + inputName);
if( optionSeparator == null )
- optionSeparator = (String)ctxValues.get( "select.separator" );
+ optionSeparator = ctxValues.get( "select.separator" );
if( optionSeparator == null )
optionSeparator = ";";
- String optionSelector = (String)pluginParams.get( "selector" );
+ String optionSelector = pluginParams.get( "selector" );
if( optionSelector == null )
- optionSelector = (String)ctxValues.get( "selector." + inputName );
+ optionSelector = ctxValues.get( "selector." + inputName );
if( optionSelector == null )
- optionSelector = (String)ctxValues.get( "select.selector" );
+ optionSelector = ctxValues.get( "select.selector" );
if( optionSelector == null )
optionSelector = "*";
if( optionSelector.equals( optionSeparator ) )
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSet.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSet.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormSet.java Thu Dec 6 21:43:33 2012
@@ -18,9 +18,12 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
-import org.apache.wiki.plugin.*;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.plugin.PluginException;
+import org.apache.wiki.plugin.WikiPlugin;
/**
* FormSet is a companion WikiPlugin for Form.
@@ -59,11 +62,10 @@ public class FormSet
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
- String formName = (String)params.get( FormElement.PARAM_FORM );
+ String formName = params.get( FormElement.PARAM_FORM );
if( formName == null || formName.trim().length() == 0 )
{
return "";
@@ -84,7 +86,7 @@ public class FormSet
// modify the original param string.
//
info.setName( formName );
- HashMap hm = new HashMap();
+ Map< String, String > hm = new HashMap< String, String >();
hm.putAll( params );
hm.remove( FormElement.PARAM_FORM );
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormTextarea.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormTextarea.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormTextarea.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/forms/FormTextarea.java Thu Dec 6 21:43:33 2012
@@ -18,14 +18,15 @@
*/
package org.apache.wiki.forms;
-import org.apache.wiki.*;
-import org.apache.wiki.plugin.PluginException;
-import org.apache.wiki.plugin.WikiPlugin;
-
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.ResourceBundle;
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.xhtml.textarea;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.plugin.PluginException;
+import org.apache.wiki.plugin.WikiPlugin;
/**
* Creates a Form text area element. You may specify the size of the textarea
@@ -33,8 +34,7 @@ import org.apache.ecs.xhtml.textarea;
* and height of the area.
*
*/
-public class FormTextarea
- extends FormElement
+public class FormTextarea extends FormElement
{
/** Parameter name for setting the rows value. Value is <tt>{@value}</tt>. */
public static final String PARAM_ROWS = "rows";
@@ -45,12 +45,12 @@ public class FormTextarea
/**
* {@inheritDoc}
*/
- public String execute( WikiContext ctx, Map params )
+ public String execute( WikiContext ctx, Map< String, String > params )
throws PluginException
{
// Don't render if no error and error-only-rendering is on.
FormInfo info = getFormInfo( ctx );
- Map previousValues = null;
+ Map< String, String > previousValues = null;
ResourceBundle rb = ctx.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
if( info != null )
@@ -64,7 +64,7 @@ public class FormTextarea
if( previousValues == null )
{
- previousValues = new HashMap();
+ previousValues = new HashMap< String, String >();
}
ConcreteElement field = null;
@@ -78,12 +78,12 @@ public class FormTextarea
return "";
}
- private textarea buildTextArea( Map params, Map previousValues, ResourceBundle rb )
+ private textarea buildTextArea( Map< String, String > params, Map< String, String > previousValues, ResourceBundle rb )
throws PluginException
{
- String inputName = (String)params.get( PARAM_INPUTNAME );
- String rows = (String)params.get( PARAM_ROWS );
- String cols = (String)params.get( PARAM_COLS );
+ String inputName = params.get( PARAM_INPUTNAME );
+ String rows = params.get( PARAM_ROWS );
+ String cols = params.get( PARAM_COLS );
if( inputName == null )
throw new PluginException( rb.getString( "formtextarea.namemissing" ) );
@@ -96,14 +96,14 @@ public class FormTextarea
if( previousValues != null )
{
- String oldValue = (String)previousValues.get( inputName );
+ String oldValue = previousValues.get( inputName );
if( oldValue != null )
{
field.addElement( oldValue );
}
else
{
- oldValue = (String)params.get( PARAM_VALUE );
+ oldValue = params.get( PARAM_VALUE );
if( oldValue != null ) field.addElement( oldValue );
}
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/parser/PluginContent.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/parser/PluginContent.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/parser/PluginContent.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/parser/PluginContent.java Thu Dec 6 21:43:33 2012
@@ -58,7 +58,7 @@ public class PluginContent extends Text
private static final long serialVersionUID = 1L;
private String m_pluginName;
- private Map<String,Object> m_params;
+ private Map<String,String> m_params;
/**
* Creates a new DOM element with the given plugin name and a map of parameters.
@@ -66,8 +66,7 @@ public class PluginContent extends Text
* @param pluginName The FQN of a plugin.
* @param parameters A Map of parameters.
*/
- @SuppressWarnings("unchecked")
- public PluginContent( String pluginName, Map parameters )
+ public PluginContent( String pluginName, Map<String, String> parameters )
{
m_pluginName = pluginName;
m_params = parameters;
@@ -99,7 +98,7 @@ public class PluginContent extends Text
*
* @return The parameter map.
*/
- public Map getParameters()
+ public Map<String, String> getParameters()
{
return m_params;
}
@@ -163,7 +162,7 @@ public class PluginContent extends Text
result = PLUGIN_START + m_pluginName + SPACE;
// convert newlines to <br> in case the plugin has a body.
- String cmdLine = ( (String)m_params.get( CMDLINE ) ).replaceAll( LINEBREAK, ELEMENT_BR );
+ String cmdLine = ( m_params.get( CMDLINE ) ).replaceAll( LINEBREAK, ELEMENT_BR );
result = result + cmdLine + PLUGIN_END;
}
@@ -174,21 +173,16 @@ public class PluginContent extends Text
WikiEngine engine = context.getEngine();
- HashMap<String,Object> parsedParams = new HashMap<String,Object>();
+ Map<String,String> parsedParams = new HashMap<String,String>();
//
// Parse any variable instances from the string
//
- for( Map.Entry e : m_params.entrySet() )
+ for( Map.Entry<String, String> e : m_params.entrySet() )
{
- Object val = e.getValue();
-
- if( val instanceof String )
- {
- val = engine.getVariableManager().expandVariables( context, (String)val );
- }
-
- parsedParams.put( (String)e.getKey(), val );
+ String val = e.getValue();
+ val = engine.getVariableManager().expandVariables( context, val );
+ parsedParams.put( e.getKey(), val );
}
result = engine.getPluginManager().execute( context,
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/AbstractReferralPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/AbstractReferralPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/AbstractReferralPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/AbstractReferralPlugin.java Thu Dec 6 21:43:33 2012
@@ -60,8 +60,7 @@ import org.apache.wiki.util.comparators.
* </ul>
*
*/
-public abstract class AbstractReferralPlugin
- implements WikiPlugin
+public abstract class AbstractReferralPlugin implements WikiPlugin
{
private static Logger log = Logger.getLogger( AbstractReferralPlugin.class );
@@ -127,15 +126,15 @@ public abstract class AbstractReferralPl
* @throws PluginException if any of the plugin parameters are malformed
*/
// FIXME: The compiled pattern strings should really be cached somehow.
- public void initialize( WikiContext context, Map params )
+ public void initialize( WikiContext context, Map<String, String> params )
throws PluginException
{
m_dateFormat = Preferences.getDateFormat( context, TimeFormat.DATETIME );
m_engine = context.getEngine();
- m_maxwidth = TextUtil.parseIntParameter( (String)params.get( PARAM_MAXWIDTH ), Integer.MAX_VALUE );
+ m_maxwidth = TextUtil.parseIntParameter( params.get( PARAM_MAXWIDTH ), Integer.MAX_VALUE );
if( m_maxwidth < 0 ) m_maxwidth = 0;
- String s = (String) params.get( PARAM_SEPARATOR );
+ String s = params.get( PARAM_SEPARATOR );
if( s != null )
{
@@ -146,21 +145,21 @@ public abstract class AbstractReferralPl
m_after = "";
}
- s = (String) params.get( PARAM_BEFORE );
+ s = params.get( PARAM_BEFORE );
if( s != null )
{
m_before = s;
}
- s = (String) params.get( PARAM_AFTER );
+ s = params.get( PARAM_AFTER );
if( s != null )
{
m_after = s;
}
- s = (String) params.get( PARAM_EXCLUDE );
+ s = params.get( PARAM_EXCLUDE );
if( s != null )
{
@@ -184,7 +183,7 @@ public abstract class AbstractReferralPl
}
// TODO: Cut-n-paste, refactor
- s = (String) params.get( PARAM_INCLUDE );
+ s = params.get( PARAM_INCLUDE );
if( s != null )
{
@@ -208,7 +207,7 @@ public abstract class AbstractReferralPl
}
// log.debug( "Requested maximum width is "+m_maxwidth );
- s = (String) params.get(PARAM_SHOW);
+ s = params.get(PARAM_SHOW);
if( s != null )
{
@@ -218,7 +217,7 @@ public abstract class AbstractReferralPl
}
}
- s = (String) params.get( PARAM_LASTMODIFIED );
+ s = params.get( PARAM_LASTMODIFIED );
if( s != null )
{
@@ -451,9 +450,9 @@ public abstract class AbstractReferralPl
/**
* Helper method to initialize the comparator for this page.
*/
- private void initSorter( WikiContext context, Map params )
+ private void initSorter( WikiContext context, Map<String, String> params )
{
- String order = (String) params.get( PARAM_SORTORDER );
+ String order = params.get( PARAM_SORTORDER );
if( order == null || order.length() == 0 )
{
// Use the configured comparator
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/BugReportHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/BugReportHandler.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/BugReportHandler.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/BugReportHandler.java Thu Dec 6 21:43:33 2012
@@ -68,7 +68,7 @@ public class BugReportHandler
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
String title;
@@ -78,9 +78,9 @@ public class BugReportHandler
SimpleDateFormat format = new SimpleDateFormat( DEFAULT_DATEFORMAT );
ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
- title = (String) params.get( PARAM_TITLE );
- description = (String) params.get( PARAM_DESCRIPTION );
- version = (String) params.get( PARAM_VERSION );
+ title = params.get( PARAM_TITLE );
+ description = params.get( PARAM_DESCRIPTION );
+ version = params.get( PARAM_VERSION );
Principal wup = context.getCurrentUser();
@@ -95,7 +95,7 @@ public class BugReportHandler
if( description == null ) description = "";
if( version == null ) version = "unknown";
- Properties mappings = parseMappings( (String) params.get( PARAM_MAPPINGS ) );
+ Properties mappings = parseMappings( params.get( PARAM_MAPPINGS ) );
//
// Start things
@@ -123,16 +123,16 @@ public class BugReportHandler
//
// Outputting the other parameters added to this.
//
- for( Iterator i = params.entrySet().iterator(); i.hasNext(); )
+ for( Iterator<Map.Entry<String, String>> i = params.entrySet().iterator(); i.hasNext(); )
{
- Map.Entry entry = (Map.Entry) i.next();
+ Map.Entry<String, String> entry = i.next();
if( entry.getKey().equals( PARAM_TITLE ) ||
entry.getKey().equals( PARAM_DESCRIPTION ) ||
entry.getKey().equals( PARAM_VERSION ) ||
entry.getKey().equals( PARAM_MAPPINGS ) ||
entry.getKey().equals( PARAM_PAGE ) ||
- entry.getKey().toString().startsWith("_") )
+ entry.getKey().startsWith("_") )
{
// Ignore this
}
@@ -142,8 +142,7 @@ public class BugReportHandler
// If no mapping has been defined, just ignore
// it.
//
- String head = mappings.getProperty( (String)entry.getKey(),
- (String)entry.getKey() );
+ String head = mappings.getProperty( entry.getKey(), entry.getKey() );
if( head.length() > 0 )
{
out.println("|"+head+
@@ -160,8 +159,7 @@ public class BugReportHandler
//
// Now create a new page for this bug report
//
- String pageName = findNextPage( context, title,
- (String)params.get( PARAM_PAGE ) );
+ String pageName = findNextPage( context, title, params.get( PARAM_PAGE ) );
WikiPage newPage = new WikiPage( context.getEngine(), pageName );
WikiContext newContext = (WikiContext)context.clone();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Counter.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Counter.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Counter.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Counter.java Thu Dec 6 21:43:33 2012
@@ -55,14 +55,14 @@ public class Counter
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
//
// First, determine which kind of name we use to store in
// the WikiContext.
//
- String countername = (String)params.get( PARAM_NAME);
+ String countername = params.get( PARAM_NAME);
if( countername == null )
{
@@ -87,7 +87,7 @@ public class Counter
// Check if we need to reset this
//
- String start = (String)params.get( PARAM_START );
+ String start = params.get( PARAM_START );
if( start != null )
{
@@ -98,13 +98,13 @@ public class Counter
//
// Determine how much to increment
//
- Object incrementObj = params.get( PARAM_INCREMENT );
+ String incrementObj = params.get( PARAM_INCREMENT );
int increment = DEFAULT_INCREMENT;
if (incrementObj != null)
{
- increment = (new Integer((String)incrementObj)).intValue();
+ increment = ( Integer.valueOf( incrementObj ) ).intValue();
}
val = val + increment;
@@ -115,13 +115,13 @@ public class Counter
//
// check if we want to hide the result (just count, don't show result on the page
//
- Object showObj = params.get(PARAM_SHOW_RESULT);
+ String showObj = params.get(PARAM_SHOW_RESULT);
boolean show = DEFAULT_SHOW_RESULT;
if( showObj != null )
{
- show = TextUtil.isPositive( (String) showObj );
+ show = TextUtil.isPositive( showObj );
}
if( show )
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/CurrentTimePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/CurrentTimePlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/CurrentTimePlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/CurrentTimePlugin.java Thu Dec 6 21:43:33 2012
@@ -36,18 +36,17 @@ import org.apache.wiki.preferences.Prefe
* @since 1.7.8
* @see java.text.SimpleDateFormat
*/
-public class CurrentTimePlugin
- implements WikiPlugin
+public class CurrentTimePlugin implements WikiPlugin
{
// private static Logger log = Logger.getLogger( CurrentTimePlugin.class );
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
- String formatString = (String)params.get("format");
+ String formatString = params.get("format");
try
{
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Denounce.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Denounce.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Denounce.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Denounce.java Thu Dec 6 21:43:33 2012
@@ -128,11 +128,11 @@ public class Denounce implements WikiPlu
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
- String link = (String) params.get( PARAM_LINK );
- String text = (String) params.get( PARAM_TEXT );
+ String link = params.get( PARAM_LINK );
+ String text = params.get( PARAM_TEXT );
boolean linkAllowed = true;
if( link == null )
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Groups.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Groups.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Groups.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Groups.java Thu Dec 6 21:43:33 2012
@@ -46,7 +46,7 @@ public class Groups
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
// Retrieve groups, and sort by name
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IfPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IfPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IfPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IfPlugin.java Thu Dec 6 21:43:33 2012
@@ -132,11 +132,10 @@ public class IfPlugin implements WikiPlu
/**
* {@inheritDoc}
*/
- public String execute(WikiContext context, Map params) throws PluginException
+ public String execute(WikiContext context, Map<String, String> params) throws PluginException
{
- return ifInclude(context,params)
- ? context.getEngine().textToHTML(
- context,(String)params.get(PluginManager.PARAM_BODY) )
+ return ifInclude( context,params )
+ ? context.getEngine().textToHTML( context, params.get( PluginManager.PARAM_BODY ) )
: "" ;
}
@@ -152,18 +151,18 @@ public class IfPlugin implements WikiPlu
* @throws PluginException If something goes wrong
* @return True, if the condition holds.
*/
- public static boolean ifInclude( WikiContext context, Map params ) throws PluginException
+ public static boolean ifInclude( WikiContext context, Map<String, String> params ) throws PluginException
{
boolean include = false;
- String group = (String)params.get(PARAM_GROUP);
- String user = (String)params.get(PARAM_USER);
- String ip = (String)params.get(PARAM_IP);
- String page = (String)params.get(PARAM_PAGE);
- String contains = (String)params.get(PARAM_CONTAINS);
- String var = (String)params.get(PARAM_VAR);
- String is = (String)params.get(PARAM_IS);
- String exists = (String)params.get(PARAM_EXISTS);
+ String group = params.get( PARAM_GROUP );
+ String user = params.get( PARAM_USER );
+ String ip = params.get( PARAM_IP );
+ String page = params.get( PARAM_PAGE );
+ String contains = params.get( PARAM_CONTAINS );
+ String var = params.get( PARAM_VAR );
+ String is = params.get( PARAM_IS );
+ String exists = params.get( PARAM_EXISTS );
include |= checkGroup(context, group);
include |= checkUser(context, user);
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Image.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Image.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Image.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Image.java Thu Dec 6 21:43:33 2012
@@ -18,10 +18,13 @@
*/
package org.apache.wiki.plugin;
-import java.util.*;
-import org.apache.wiki.*;
-import org.apache.wiki.attachment.AttachmentManager;
+import java.util.Map;
+
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiEngine;
import org.apache.wiki.attachment.Attachment;
+import org.apache.wiki.attachment.AttachmentManager;
import org.apache.wiki.providers.ProviderException;
/**
@@ -79,15 +82,15 @@ public class Image
* This method is used to clean away things like quotation marks which
* a malicious user could use to stop processing and insert javascript.
*/
- private static final String getCleanParameter( Map params, String paramId )
+ private static final String getCleanParameter( Map<String, String> params, String paramId )
{
- return TextUtil.replaceEntities( (String) params.get( paramId ) );
+ return TextUtil.replaceEntities( params.get( paramId ) );
}
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
WikiEngine engine = context.getEngine();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IndexPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IndexPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IndexPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/IndexPlugin.java Thu Dec 6 21:43:33 2012
@@ -25,7 +25,6 @@ import org.apache.ecs.Element;
import org.apache.ecs.xhtml.div;
import org.apache.ecs.xhtml.span;
import org.apache.log4j.Logger;
-
import org.apache.wiki.WikiContext;
import org.apache.wiki.providers.ProviderException;
@@ -47,10 +46,10 @@ public class IndexPlugin extends Abstra
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params ) throws PluginException
+ public String execute( WikiContext context, Map<String, String> params ) throws PluginException
{
- String include = (String)params.get( PARAM_INCLUDE );
- String exclude = (String)params.get( PARAM_EXCLUDE );
+ String include = params.get( PARAM_INCLUDE );
+ String exclude = params.get( PARAM_EXCLUDE );
List<String> pages;
div masterDiv = new div();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InitializablePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InitializablePlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InitializablePlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InitializablePlugin.java Thu Dec 6 21:43:33 2012
@@ -43,6 +43,5 @@ public interface InitializablePlugin
* @throws PluginException If something goes wrong.
*/
- public void initialize( WikiEngine engine )
- throws PluginException;
+ void initialize( WikiEngine engine ) throws PluginException;
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InsertPage.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InsertPage.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InsertPage.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/InsertPage.java Thu Dec 6 21:43:33 2012
@@ -18,13 +18,18 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
-import org.apache.wiki.auth.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiPage;
+import org.apache.wiki.auth.AuthorizationManager;
import org.apache.wiki.auth.permissions.PermissionFactory;
import org.apache.wiki.providers.ProviderException;
-import java.util.*;
-
/**
* Inserts page contents. Muchos thanks to Scott Hurlbert for the initial code.
*
@@ -67,21 +72,19 @@ public class InsertPage
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
WikiEngine engine = context.getEngine();
StringBuffer res = new StringBuffer();
- String clazz = (String) params.get( PARAM_CLASS );
- String includedPage = (String) params.get( PARAM_PAGENAME );
- String style = (String) params.get( PARAM_STYLE );
- String defaultstr = (String) params.get( PARAM_DEFAULT );
- int section = TextUtil.parseIntParameter((String) params.get( PARAM_SECTION ),
- -1 );
- int maxlen = TextUtil.parseIntParameter((String) params.get( PARAM_MAXLENGTH ),
- -1 );
+ String clazz = params.get( PARAM_CLASS );
+ String includedPage = params.get( PARAM_PAGENAME );
+ String style = params.get( PARAM_STYLE );
+ String defaultstr = params.get( PARAM_DEFAULT );
+ int section = TextUtil.parseIntParameter(params.get( PARAM_SECTION ), -1 );
+ int maxlen = TextUtil.parseIntParameter(params.get( PARAM_MAXLENGTH ), -1 );
if( style == null ) style = DEFAULT_STYLE;
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ListLocksPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ListLocksPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ListLocksPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ListLocksPlugin.java Thu Dec 6 21:43:33 2012
@@ -18,11 +18,16 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.wiki.PageLock;
+import org.apache.wiki.PageManager;
+import org.apache.wiki.WikiContext;
import org.apache.wiki.preferences.Preferences;
-import java.util.*;
-
/**
* This is a plugin for the administrator: It allows him to see in a single
* glance who is editing what.
@@ -37,7 +42,7 @@ public class ListLocksPlugin
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
StringBuffer result = new StringBuffer();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Note.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Note.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Note.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Note.java Thu Dec 6 21:43:33 2012
@@ -58,9 +58,9 @@ public class Note implements WikiPlugin
/**
* {@inheritDoc}
*/
- public String execute(WikiContext context, Map params) throws PluginException
+ public String execute(WikiContext context, Map<String, String> params) throws PluginException
{
- String commandline = (String) params.get(PluginManager.PARAM_CMDLINE);
+ String commandline = params.get(PluginManager.PARAM_CMDLINE);
if (commandline == null || commandline.length() == 0)
{
return "Unable to obtain plugin command line from parameter'" + PluginManager.PARAM_CMDLINE + "'"; // I18N
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PageViewPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PageViewPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PageViewPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PageViewPlugin.java Thu Dec 6 21:43:33 2012
@@ -160,7 +160,7 @@ public class PageViewPlugin extends Abst
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params ) throws PluginException
+ public String execute( WikiContext context, Map<String, String> params ) throws PluginException
{
PageViewManager manager = c_singleton;
@@ -306,7 +306,7 @@ public class PageViewPlugin extends Abst
* @return String Wiki page snippet
* @throws PluginException Malformed pattern parameter.
*/
- public String execute( WikiContext context, Map params ) throws PluginException
+ public String execute( WikiContext context, Map<String, String> params ) throws PluginException
{
WikiEngine engine = context.getEngine();
WikiPage page = context.getPage();
@@ -316,16 +316,16 @@ public class PageViewPlugin extends Abst
{
// get parameters
String pagename = page.getName();
- String count = (String) params.get( PARAM_COUNT );
- String show = (String) params.get( PARAM_SHOW );
- int entries = TextUtil.parseIntParameter( (String) params.get( PARAM_MAX_ENTRIES ), Integer.MAX_VALUE );
- final int max = TextUtil.parseIntParameter( (String) params.get( PARAM_MAX_COUNT ), Integer.MAX_VALUE );
- final int min = TextUtil.parseIntParameter( (String) params.get( PARAM_MIN_COUNT ), Integer.MIN_VALUE );
- String sort = (String) params.get( PARAM_SORT );
- String body = (String) params.get( PluginManager.PARAM_BODY );
- Pattern[] exclude = compileGlobs( PARAM_EXCLUDE, (String) params.get( PARAM_EXCLUDE ) );
- Pattern[] include = compileGlobs( PARAM_INCLUDE, (String) params.get( PARAM_INCLUDE ) );
- Pattern[] refer = compileGlobs( PARAM_REFER, (String) params.get( PARAM_REFER ) );
+ String count = params.get( PARAM_COUNT );
+ String show = params.get( PARAM_SHOW );
+ int entries = TextUtil.parseIntParameter( params.get( PARAM_MAX_ENTRIES ), Integer.MAX_VALUE );
+ final int max = TextUtil.parseIntParameter( params.get( PARAM_MAX_COUNT ), Integer.MAX_VALUE );
+ final int min = TextUtil.parseIntParameter( params.get( PARAM_MIN_COUNT ), Integer.MIN_VALUE );
+ String sort = params.get( PARAM_SORT );
+ String body = params.get( PluginManager.PARAM_BODY );
+ Pattern[] exclude = compileGlobs( PARAM_EXCLUDE, params.get( PARAM_EXCLUDE ) );
+ Pattern[] include = compileGlobs( PARAM_INCLUDE, params.get( PARAM_INCLUDE ) );
+ Pattern[] refer = compileGlobs( PARAM_REFER, params.get( PARAM_REFER ) );
PatternMatcher matcher = (null != exclude || null != include || null != refer) ? new Perl5Matcher() : null;
boolean increment = false;
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ParserStagePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ParserStagePlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ParserStagePlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ParserStagePlugin.java Thu Dec 6 21:43:33 2012
@@ -38,5 +38,5 @@ public interface ParserStagePlugin
* @param context WikiContext, as usual.
* @param params Parsed parameters for the plugin.
*/
- public void executeParser( PluginContent element, WikiContext context, Map params );
+ public void executeParser( PluginContent element, WikiContext context, Map<String, String> params );
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PluginManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PluginManager.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PluginManager.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/PluginManager.java Thu Dec 6 21:43:33 2012
@@ -27,17 +27,16 @@ import org.apache.commons.lang.ClassUtil
import org.apache.ecs.xhtml.*;
import org.apache.log4j.Logger;
import org.apache.oro.text.regex.*;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.jdom.xpath.XPath;
-
import org.apache.wiki.*;
import org.apache.wiki.modules.ModuleManager;
import org.apache.wiki.modules.WikiModuleInfo;
import org.apache.wiki.parser.PluginContent;
import org.apache.wiki.util.ClassUtil;
+import org.jdom.Document;
+import org.jdom.Element;
+import org.jdom.JDOMException;
+import org.jdom.input.SAXBuilder;
+import org.jdom.xpath.XPath;
/**
* Manages plugin classes. There exists a single instance of PluginManager
@@ -285,7 +284,7 @@ public class PluginManager extends Modul
/**
* Outputs a HTML-formatted version of a stack trace.
*/
- private String stackTrace( Map params, Throwable t )
+ private String stackTrace( Map< String, String > params, Throwable t )
{
div d = new div();
d.setClass("debug");
@@ -296,10 +295,10 @@ public class PluginManager extends Modul
d.addElement( new b( "Parameters to the plugin" ) );
ul list = new ul();
- for( Iterator i = params.entrySet().iterator(); i.hasNext(); )
+ for( Iterator<Map.Entry< String, String > > i = params.entrySet().iterator(); i.hasNext(); )
{
- Map.Entry e = (Map.Entry) i.next();
- String key = (String)e.getKey();
+ Map.Entry< String, String > e = i.next();
+ String key = e.getKey();
list.addElement(new li( key+"'='"+e.getValue() ) );
}
@@ -329,7 +328,7 @@ public class PluginManager extends Modul
*/
public String execute( WikiContext context,
String classname,
- Map params )
+ Map< String, String > params )
throws PluginException
{
if( !m_pluginsEnabled )
@@ -341,7 +340,7 @@ public class PluginManager extends Modul
{
WikiPlugin plugin;
- boolean debug = TextUtil.isPositive( (String) params.get( PARAM_DEBUG ) );
+ boolean debug = TextUtil.isPositive( params.get( PARAM_DEBUG ) );
WikiPluginInfo pluginInfo = m_pluginClassMap.get(classname);
@@ -438,10 +437,10 @@ public class PluginManager extends Modul
*
* @throws IOException If the parsing fails.
*/
- public Map parseArgs( String argstring )
+ public Map<String, String> parseArgs( String argstring )
throws IOException
{
- HashMap<String, Object> arglist = new HashMap<String, Object>();
+ HashMap<String, String> arglist = new HashMap<String, String>();
//
// Protection against funny users.
@@ -579,7 +578,7 @@ public class PluginManager extends Modul
String args = commandline.substring(res.endOffset(0),
commandline.length() -
(commandline.charAt(commandline.length()-1) == '}' ? 1 : 0 ) );
- Map arglist = parseArgs( args );
+ Map<String, String> arglist = parseArgs( args );
return execute( context, plugin, arglist );
}
@@ -612,7 +611,6 @@ public class PluginManager extends Modul
* @return A DOM element
* @throws PluginException If plugin invocation is faulty
*/
- @SuppressWarnings("unchecked")
public PluginContent parsePluginLine( WikiContext context, String commandline, int pos )
throws PluginException
{
@@ -628,13 +626,13 @@ public class PluginManager extends Modul
String args = commandline.substring(res.endOffset(0),
commandline.length() -
(commandline.charAt(commandline.length()-1) == '}' ? 1 : 0 ) );
- Map<String, Object> arglist = parseArgs( args );
+ Map<String, String> arglist = parseArgs( args );
// set wikitext bounds of plugin as '_bounds' parameter, e.g., [345,396]
if ( pos != -1 )
{
int end = pos + commandline.length() + 2;
- int[] bounds = new int[] { pos, end };
+ String bounds = pos + "|" + end;
arglist.put( PARAM_BOUNDS, bounds );
}
@@ -1019,7 +1017,7 @@ public class PluginManager extends Modul
ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
Object[] args = { content.getPluginName() };
- Map params = content.getParameters();
+ Map<String, String> params = content.getParameters();
try
{
WikiPlugin plugin;
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RPCSamplePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RPCSamplePlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RPCSamplePlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RPCSamplePlugin.java Thu Dec 6 21:43:33 2012
@@ -53,7 +53,7 @@ public class RPCSamplePlugin implements
/**
* {@inheritDoc}
*/
- public String execute(WikiContext context, Map params) throws PluginException
+ public String execute(WikiContext context, Map<String, String> params) throws PluginException
{
JSONRPCManager.registerJSONObject( context, this );
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RecentChangesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RecentChangesPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RecentChangesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/RecentChangesPlugin.java Thu Dec 6 21:43:33 2012
@@ -24,7 +24,6 @@ import java.util.*;
import org.apache.ecs.xhtml.*;
import org.apache.log4j.Logger;
-
import org.apache.wiki.TextUtil;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiEngine;
@@ -74,10 +73,10 @@ public class RecentChangesPlugin extends
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
- int since = TextUtil.parseIntParameter( (String) params.get( "since" ), DEFAULT_DAYS );
+ int since = TextUtil.parseIntParameter( params.get( "since" ), DEFAULT_DAYS );
int spacing = 4;
boolean showAuthor = true;
boolean showChangenote = true;
@@ -101,8 +100,7 @@ public class RecentChangesPlugin extends
log.debug("Calculating recent changes from "+sincedate.getTime());
- // FIXME: Should really have a since date on the getRecentChanges
- // method.
+ // FIXME: Should really have a since date on the getRecentChanges method.
Collection changes = engine.getRecentChanges();
super.initialize( context, params );
changes = super.filterCollection( changes );
@@ -237,7 +235,7 @@ public class RecentChangesPlugin extends
// locale, but that is at odds with the 1st version of this plugin. We seek to preserve the
// behaviour of that first version, so to get the default format, the user must explicitly do
// something like: dateFormat='' timeformat='' which is a odd, but probably okay.
- private DateFormat getTimeFormat( WikiContext context, Map params )
+ private DateFormat getTimeFormat( WikiContext context, Map<String, String> params )
{
String formatString = get(params, DEFAULT_TIME_FORMAT, PARAM_TIME_FORMAT);
@@ -249,7 +247,7 @@ public class RecentChangesPlugin extends
- private DateFormat getDateFormat( WikiContext context, Map params )
+ private DateFormat getDateFormat( WikiContext context, Map<String, String> params )
{
String formatString = get(params, DEFAULT_DATE_FORMAT, PARAM_DATE_FORMAT);
@@ -262,9 +260,9 @@ public class RecentChangesPlugin extends
- private String get(Map params, String defaultValue, String paramName)
+ private String get(Map<String, String> params, String defaultValue, String paramName)
{
- String value = (String) params.get(paramName);
+ String value = params.get(paramName);
return null == value ? defaultValue : value;
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferredPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferredPagesPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferredPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferredPagesPlugin.java Thu Dec 6 21:43:33 2012
@@ -22,7 +22,6 @@ import java.util.*;
import org.apache.log4j.Logger;
import org.apache.oro.text.regex.*;
-
import org.apache.wiki.*;
@@ -80,7 +79,7 @@ public class ReferredPagesPlugin impleme
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
m_engine = context.getEngine();
@@ -89,21 +88,21 @@ public class ReferredPagesPlugin impleme
if( page == null ) return "";
// parse parameters
- String rootname = (String)params.get( PARAM_ROOT );
+ String rootname = params.get( PARAM_ROOT );
if( rootname == null ) rootname = page.getName() ;
- String format = (String)params.get( PARAM_FORMAT );
+ String format = params.get( PARAM_FORMAT );
if( format == null) format = "";
if( format.indexOf( "full" ) >=0 ) m_formatCompact = false ;
if( format.indexOf( "sort" ) >=0 ) m_formatSort = true ;
- m_depth = TextUtil.parseIntParameter( (String)params.get( PARAM_DEPTH ), MIN_DEPTH );
+ m_depth = TextUtil.parseIntParameter( params.get( PARAM_DEPTH ), MIN_DEPTH );
if( m_depth > MAX_DEPTH ) m_depth = MAX_DEPTH;
- String includePattern = (String) params.get(PARAM_INCLUDE);
+ String includePattern = params.get(PARAM_INCLUDE);
if( includePattern == null ) includePattern = ".*";
- String excludePattern = (String) params.get(PARAM_EXCLUDE);
+ String excludePattern = params.get(PARAM_EXCLUDE);
if( excludePattern == null ) excludePattern = "^$";
log.debug( "Fetching referred pages for "+ rootname +
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferringPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferringPagesPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferringPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/ReferringPagesPlugin.java Thu Dec 6 21:43:33 2012
@@ -18,11 +18,16 @@
*/
package org.apache.wiki.plugin;
-import org.apache.log4j.Logger;
-import org.apache.wiki.*;
-
import java.text.MessageFormat;
-import java.util.*;
+import java.util.Collection;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import org.apache.log4j.Logger;
+import org.apache.wiki.ReferenceManager;
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiPage;
/**
* Displays the pages referring to the current page.
@@ -62,11 +67,11 @@ public class ReferringPagesPlugin
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
ReferenceManager refmgr = context.getEngine().getReferenceManager();
- String pageName = (String)params.get( PARAM_PAGE );
+ String pageName = params.get( PARAM_PAGE );
ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
StringBuffer result = new StringBuffer( 256 );
@@ -85,8 +90,8 @@ public class ReferringPagesPlugin
super.initialize( context, params );
- int items = TextUtil.parseIntParameter( (String)params.get( PARAM_MAX ), ALL_ITEMS );
- String extras = (String)params.get( PARAM_EXTRAS );
+ int items = TextUtil.parseIntParameter( params.get( PARAM_MAX ), ALL_ITEMS );
+ String extras = params.get( PARAM_EXTRAS );
if( extras == null )
{
extras = rb.getString("referringpagesplugin.more");
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Search.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Search.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Search.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/Search.java Thu Dec 6 21:43:33 2012
@@ -25,7 +25,6 @@ import java.util.Map;
import org.apache.ecs.xhtml.*;
import org.apache.log4j.Logger;
-
import org.apache.wiki.SearchResult;
import org.apache.wiki.WikiContext;
import org.apache.wiki.WikiEngine;
@@ -66,14 +65,14 @@ public class Search implements WikiPlugi
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params ) throws PluginException
+ public String execute( WikiContext context, Map<String, String> params ) throws PluginException
{
int maxItems = Integer.MAX_VALUE;
Collection results = null;
- String queryString = (String)params.get( PARAM_QUERY );
- String set = (String)params.get( PARAM_SET );
- String max = (String)params.get( PARAM_MAX );
+ String queryString = params.get( PARAM_QUERY );
+ String set = params.get( PARAM_SET );
+ String max = params.get( PARAM_MAX );
if( set == null ) set = DEFAULT_SETNAME;
if( max != null ) maxItems = Integer.parseInt( max );
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/SessionsPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/SessionsPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/SessionsPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/SessionsPlugin.java Thu Dec 6 21:43:33 2012
@@ -53,11 +53,11 @@ public class SessionsPlugin
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
WikiEngine engine = context.getEngine();
- String prop = (String) params.get( PARAM_PROP );
+ String prop = params.get( PARAM_PROP );
if ( "users".equals( prop ) )
{
@@ -93,8 +93,7 @@ public class SessionsPlugin
}
else
{
- // first time we see this entry, add entry to HashMap with
- // value 1
+ // first time we see this entry, add entry to HashMap with value 1
distinctPrincipals.put(principalName, 1);
}
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/TableOfContents.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/TableOfContents.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/TableOfContents.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/TableOfContents.java Thu Dec 6 21:43:33 2012
@@ -18,16 +18,17 @@
*/
package org.apache.wiki.plugin;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Map;
+import java.util.ResourceBundle;
+
import org.apache.log4j.Logger;
import org.apache.wiki.*;
import org.apache.wiki.parser.Heading;
import org.apache.wiki.parser.HeadingListener;
import org.apache.wiki.parser.JSPWikiMarkupParser;
-import java.util.*;
-import java.io.StringReader;
-import java.io.IOException;
-
/**
* Provides a table of contents.
* <p>Parameters : </p>
@@ -140,7 +141,7 @@ public class TableOfContents
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
WikiEngine engine = context.getEngine();
@@ -156,7 +157,7 @@ public class TableOfContents
sb.append("<div class=\"toc\">\n");
sb.append("<div class=\"collapsebox\">\n");
- String title = (String) params.get(PARAM_TITLE);
+ String title = params.get(PARAM_TITLE);
sb.append("<h4 id=\"section-TOC\">");
if( title != null )
{
@@ -174,7 +175,7 @@ public class TableOfContents
m_usingNumberedList = false;
if (params.containsKey(PARAM_NUMBERED))
{
- String numbered = (String)params.get(PARAM_NUMBERED);
+ String numbered = params.get(PARAM_NUMBERED);
if (numbered.equalsIgnoreCase("true"))
{
m_usingNumberedList = true;
@@ -189,7 +190,7 @@ public class TableOfContents
if (m_usingNumberedList)
{
int start = 0;
- String startStr = (String)params.get(PARAM_START);
+ String startStr = params.get(PARAM_START);
if ((startStr != null) && (startStr.matches("^\\d+$")))
{
start = Integer.parseInt(startStr);
@@ -201,7 +202,7 @@ public class TableOfContents
if (m_level1Index < 0) m_level1Index = 0;
m_level2Index = 0;
m_level3Index = 0;
- m_prefix = (String)params.get(PARAM_PREFIX);
+ m_prefix = params.get(PARAM_PREFIX);
if (m_prefix == null) m_prefix = "";
m_lastLevel = Heading.HEADING_LARGE;
}
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UndefinedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UndefinedPagesPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UndefinedPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UndefinedPagesPlugin.java Thu Dec 6 21:43:33 2012
@@ -18,9 +18,11 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
+import java.util.Collection;
+import java.util.Map;
-import java.util.*;
+import org.apache.wiki.ReferenceManager;
+import org.apache.wiki.WikiContext;
/**
* Plugin that enumerates the pages in the wiki that have not yet been defined.
@@ -38,8 +40,7 @@ public class UndefinedPagesPlugin
/**
* {@inheritDoc}
*/
- @SuppressWarnings("unchecked")
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
ReferenceManager refmgr = context.getEngine().getReferenceManager();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UnusedPagesPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UnusedPagesPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UnusedPagesPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/UnusedPagesPlugin.java Thu Dec 6 21:43:33 2012
@@ -18,8 +18,13 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
-import java.util.*;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.wiki.ReferenceManager;
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
/**
* Plugin for displaying pages that are not linked to in other pages.
@@ -44,7 +49,7 @@ public class UnusedPagesPlugin
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
ReferenceManager refmgr = context.getEngine().getReferenceManager();
@@ -52,7 +57,7 @@ public class UnusedPagesPlugin
//
// filter out attachments if "excludeattachments" was requested:
//
- String prop = (String) params.get( PARAM_EXCLUDEATTS );
+ String prop = params.get( PARAM_EXCLUDEATTS );
if( TextUtil.isPositive(prop) )
{
// remove links to attachments (recognizable by a slash in it)
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogArchivePlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogArchivePlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogArchivePlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogArchivePlugin.java Thu Dec 6 21:43:33 2012
@@ -18,13 +18,16 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
-import org.apache.wiki.providers.ProviderException;
-import org.apache.log4j.Logger;
-
import java.text.SimpleDateFormat;
import java.util.*;
+import org.apache.log4j.Logger;
+import org.apache.wiki.TextUtil;
+import org.apache.wiki.WikiContext;
+import org.apache.wiki.WikiEngine;
+import org.apache.wiki.WikiPage;
+import org.apache.wiki.providers.ProviderException;
+
/**
* Creates a list of all weblog entries on a monthly basis.
*
@@ -47,7 +50,7 @@ public class WeblogArchivePlugin impleme
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
WikiEngine engine = context.getEngine();
@@ -55,7 +58,7 @@ public class WeblogArchivePlugin impleme
//
// Parameters
//
- String weblogName = (String) params.get( PARAM_PAGE );
+ String weblogName = params.get( PARAM_PAGE );
if( weblogName == null ) weblogName = context.getPage().getName();
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogEntryPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogEntryPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogEntryPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogEntryPlugin.java Thu Dec 6 21:43:33 2012
@@ -18,13 +18,13 @@
*/
package org.apache.wiki.plugin;
-import org.apache.wiki.*;
-import org.apache.wiki.providers.ProviderException;
-import org.apache.log4j.Logger;
-
import java.text.SimpleDateFormat;
import java.util.*;
+import org.apache.log4j.Logger;
+import org.apache.wiki.*;
+import org.apache.wiki.providers.ProviderException;
+
/**
* Builds a simple weblog.
*
@@ -83,12 +83,12 @@ public class WeblogEntryPlugin implement
/**
* {@inheritDoc}
*/
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
ResourceBundle rb = context.getBundle(WikiPlugin.CORE_PLUGINS_RESOURCEBUNDLE);
- String weblogName = (String)params.get( PARAM_BLOGNAME );
+ String weblogName = params.get( PARAM_BLOGNAME );
if( weblogName == null )
{
weblogName = context.getPage().getName();
@@ -97,7 +97,7 @@ public class WeblogEntryPlugin implement
StringBuffer sb = new StringBuffer();
- String entryText = (String) params.get(PARAM_ENTRYTEXT);
+ String entryText = params.get(PARAM_ENTRYTEXT);
if( entryText == null )
entryText = rb.getString("weblogentryplugin.newentry");
Modified: incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogPlugin.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogPlugin.java?rev=1418094&r1=1418093&r2=1418094&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogPlugin.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/plugin/WeblogPlugin.java Thu Dec 6 21:43:33 2012
@@ -21,20 +21,11 @@ package org.apache.wiki.plugin;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
-
import org.apache.wiki.*;
import org.apache.wiki.auth.AuthorizationManager;
import org.apache.wiki.auth.permissions.PagePermission;
@@ -151,7 +142,7 @@ public class WeblogPlugin
* {@inheritDoc}
*/
@SuppressWarnings("unchecked")
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map<String, String> params )
throws PluginException
{
Calendar startTime;
@@ -170,14 +161,14 @@ public class WeblogPlugin
int maxEntries;
String weblogName;
- if( (weblogName = (String) params.get(PARAM_PAGE)) == null )
+ if( (weblogName = params.get(PARAM_PAGE)) == null )
{
weblogName = context.getPage().getName();
}
if( (days = context.getHttpParameter( "weblog."+PARAM_DAYS )) == null )
{
- days = (String) params.get( PARAM_DAYS );
+ days = params.get( PARAM_DAYS );
}
if( ( params.get(PARAM_ENTRYFORMAT)) == null )
@@ -186,7 +177,7 @@ public class WeblogPlugin
}
else
{
- entryFormat = new SimpleDateFormat( (String)params.get(PARAM_ENTRYFORMAT) );
+ entryFormat = new SimpleDateFormat( params.get(PARAM_ENTRYFORMAT) );
}
if( days != null )
@@ -202,17 +193,17 @@ public class WeblogPlugin
}
- if( (startDay = (String)params.get(PARAM_STARTDATE)) == null )
+ if( (startDay = params.get(PARAM_STARTDATE)) == null )
{
startDay = context.getHttpParameter( "weblog."+PARAM_STARTDATE );
}
- if( TextUtil.isPositive( (String)params.get(PARAM_ALLOWCOMMENTS) ) )
+ if( TextUtil.isPositive( params.get(PARAM_ALLOWCOMMENTS) ) )
{
hasComments = true;
}
- maxEntries = TextUtil.parseIntParameter( (String)params.get(PARAM_MAXENTRIES),
+ maxEntries = TextUtil.parseIntParameter( params.get(PARAM_MAXENTRIES),
Integer.MAX_VALUE );
//
@@ -502,7 +493,7 @@ public class WeblogPlugin
* Mark us as being a real weblog.
* {@inheritDoc}
*/
- public void executeParser(PluginContent element, WikiContext context, Map params)
+ public void executeParser(PluginContent element, WikiContext context, Map<String, String> params)
{
context.getPage().setAttribute( ATTR_ISWEBLOG, "true" );
}