You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by aj...@apache.org on 2008/02/23 20:36:04 UTC
svn commit: r630515 - in
/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki:
ui/admin/ util/ workflow/ xmlrpc/
Author: ajaquith
Date: Sat Feb 23 11:35:56 2008
New Revision: 630515
URL: http://svn.apache.org/viewvc?rev=630515&view=rev
Log:
Initial Stripes component commit.
Modified:
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/ClassUtil.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/FormUtil.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/PriorityList.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/AbstractStep.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Decision.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/DecisionQueue.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Workflow.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowBuilder.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowManager.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/AbstractRPCHandler.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java
incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/ui/admin/AdminBeanManager.java Sat Feb 23 11:35:56 2008
@@ -51,7 +51,7 @@
public class AdminBeanManager implements WikiEventListener
{
private WikiEngine m_engine;
- private ArrayList m_allBeans;
+ private ArrayList<AdminBean> m_allBeans;
private MBeanServer m_mbeanServer = null;
@@ -211,7 +211,7 @@
// FIXME: Should unload the beans first.
private void reload()
{
- m_allBeans = new ArrayList();
+ m_allBeans = new ArrayList<AdminBean>();
try
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/BlogUtil.java Sat Feb 23 11:35:56 2008
@@ -20,6 +20,7 @@
package com.ecyrd.jspwiki.util;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.WikiActionBean;
/**
@@ -45,21 +46,28 @@
* @param context the wiki context
* @return the site name
*/
- public static String getSiteName( WikiContext context )
+ public static String getSiteName( WikiActionBean actionBean )
{
- WikiEngine engine = context.getEngine();
+ WikiEngine engine = actionBean.getEngine();
String blogname = null;
try
{
- blogname = engine.getVariableManager().getValue( context, VAR_BLOGNAME );
+ blogname = engine.getVariableManager().getValue( actionBean, VAR_BLOGNAME );
}
catch( NoSuchVariableException e ) {}
if( blogname == null )
{
- blogname = engine.getApplicationName()+": "+context.getPage().getName();
+ if ( actionBean instanceof WikiContext )
+ {
+ blogname = engine.getApplicationName()+": "+((WikiContext)actionBean).getPage().getName();
+ }
+ else
+ {
+ blogname = engine.getApplicationName();
+ }
}
return blogname;
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/ClassUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/ClassUtil.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/ClassUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/ClassUtil.java Sat Feb 23 11:35:56 2008
@@ -48,7 +48,7 @@
*/
public static final String MAPPINGS = "/ini/classmappings.xml";
- private static Map c_classMappings = new Hashtable();
+ private static Map<String,String> c_classMappings = new Hashtable<String,String>();
/**
* Initialize the class mappings document.
@@ -65,9 +65,9 @@
XPath xpath = XPath.newInstance("/classmappings/mapping");
- List nodes = xpath.selectNodes( doc );
+ List<?> nodes = xpath.selectNodes( doc );
- for( Iterator i = nodes.iterator(); i.hasNext(); )
+ for( Iterator<?> i = nodes.iterator(); i.hasNext(); )
{
Element f = (Element) i.next();
@@ -110,7 +110,7 @@
* @throws ClassNotFoundException if this particular class cannot be found
* from the list.
*/
- public static Class findClass( List packages, String className )
+ public static Class<?> findClass( List<String> packages, String className )
throws ClassNotFoundException
{
ClassLoader loader = ClassUtil.class.getClassLoader();
@@ -121,10 +121,8 @@
}
catch( ClassNotFoundException e )
{
- for( Iterator i = packages.iterator(); i.hasNext(); )
+ for( String packageName : packages )
{
- String packageName = (String)i.next();
-
try
{
return loader.loadClass( packageName + "." + className );
@@ -150,10 +148,10 @@
* @throws ClassNotFoundException if this particular class cannot be found.
*/
- public static Class findClass( String packageName, String className )
+ public static Class<?> findClass( String packageName, String className )
throws ClassNotFoundException
{
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
list.add( packageName );
return findClass( list, className );
@@ -252,7 +250,7 @@
{
try
{
- Class cl = getMappedClass( requestedClass );
+ Class<?> cl = getMappedClass( requestedClass );
Constructor[] ctors = cl.getConstructors();
@@ -321,10 +319,10 @@
* @return A Class object which you can then instantiate.
* @throws WikiException
*/
- private static Class getMappedClass( String requestedClass )
+ private static Class<?> getMappedClass( String requestedClass )
throws WikiException
{
- String mappedClass = (String)c_classMappings.get( requestedClass );
+ String mappedClass = c_classMappings.get( requestedClass );
if( mappedClass == null )
{
@@ -333,7 +331,7 @@
try
{
- Class cl = Class.forName(mappedClass);
+ Class<?> cl = Class.forName(mappedClass);
return cl;
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/FormUtil.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/FormUtil.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/FormUtil.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/FormUtil.java Sat Feb 23 11:35:56 2008
@@ -55,12 +55,12 @@
public static List getValues( Map params, String key )
{
if( params == null || key == null )
- return new ArrayList(0);
+ return new ArrayList<Object>(0);
Object entry = params.get( key );
if( entry != null )
{
- ArrayList rval = new ArrayList(1);
+ List<Object> rval = new ArrayList<Object>(1);
rval.add( entry );
return rval;
}
@@ -87,9 +87,9 @@
* @return ArrayList, containing the values corresponding to the
* keyPrefix, in order.
*/
- public static ArrayList getNumberedValues( Map params, String keyPrefix )
+ public static List<Object> getNumberedValues( Map<String,Object> params, String keyPrefix )
{
- ArrayList rval = new ArrayList();
+ List<Object> rval = new ArrayList<Object>();
if( params == null ||
params.size() == 0 ||
keyPrefix == null ||
@@ -136,10 +136,10 @@
* @param filterPrefix the prefix
* @return the Map containing parsed key/value pairs
*/
- public static Map requestToMap( HttpServletRequest req,
+ public static Map<String,String> requestToMap( HttpServletRequest req,
String filterPrefix )
{
- HashMap params = new HashMap();
+ Map<String,String> params = new HashMap<String,String>();
if( filterPrefix == null ) filterPrefix = "";
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/PriorityList.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/PriorityList.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/PriorityList.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/PriorityList.java Sat Feb 23 11:35:56 2008
@@ -21,6 +21,7 @@
import java.util.AbstractList;
import java.util.ArrayList;
+import java.util.List;
/**
* Builds a simple, priority-based List implementation. The list
@@ -33,10 +34,10 @@
*
* @author Janne Jalkanen
*/
-public class PriorityList
- extends AbstractList
+public class PriorityList<T>
+ extends AbstractList<T>
{
- private ArrayList m_elements = new ArrayList();
+ private final List<Item<T>> m_elements = new ArrayList<Item<T>>();
/**
* This is the default priority, which is used if no priority
@@ -51,13 +52,13 @@
* @param o Object to add.
* @param priority Priority.
*/
- public void add( Object o, int priority )
+ public void add( T o, int priority )
{
int i = 0;
for( ; i < m_elements.size(); i++ )
{
- Item item = (Item) m_elements.get(i);
+ Item item = m_elements.get(i);
if( item.m_priority < priority )
{
@@ -65,7 +66,7 @@
}
}
- Item newItem = new Item();
+ Item<T> newItem = new Item<T>();
newItem.m_priority = priority;
newItem.m_object = o;
@@ -78,7 +79,7 @@
* @param o Object to add.
* @return true, as per the general Collections.add contract.
*/
- public boolean add( Object o )
+ public boolean add( T o )
{
add( o, DEFAULT_PRIORITY );
@@ -91,9 +92,9 @@
* @param index The index.
* @return The object at the list at the position "index".
*/
- public Object get( int index )
+ public T get( int index )
{
- return ((Item)m_elements.get( index )).m_object;
+ return m_elements.get( index ).m_object;
}
/**
@@ -109,9 +110,9 @@
/**
* Provides a holder for the priority-object 2-tuple.
*/
- private static class Item
+ private static class Item<T>
{
public int m_priority;
- public Object m_object;
+ public T m_object;
}
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/util/WatchDog.java Sat Feb 23 11:35:56 2008
@@ -50,13 +50,13 @@
public final class WatchDog
{
private Watchable m_watchable;
- private Stack m_stateStack = new Stack();
+ private Stack<State> m_stateStack = new Stack<State>();
private boolean m_enabled = true;
private WikiEngine m_engine;
private static Logger log = Logger.getLogger(WatchDog.class.getName());
- private static HashMap c_kennel = new HashMap();
+ private static HashMap<Integer,WeakReference<WatchDog>> c_kennel = new HashMap<Integer,WeakReference<WatchDog>>();
private static WikiBackgroundThread c_watcherThread;
/**
@@ -74,14 +74,14 @@
Thread t = Thread.currentThread();
WatchDog wd = null;
- WeakReference w = (WeakReference)c_kennel.get( new Integer(t.hashCode()) );
+ WeakReference<WatchDog> w = c_kennel.get( new Integer(t.hashCode()) );
- if( w != null ) wd = (WatchDog)w.get();
+ if( w != null ) wd = w.get();
if( w == null || wd == null )
{
wd = new WatchDog( engine, t );
- w = new WeakReference(wd);
+ w = new WeakReference<WatchDog>(wd);
synchronized( c_kennel )
{
@@ -142,11 +142,9 @@
synchronized( c_kennel )
{
- for( Iterator i = c_kennel.entrySet().iterator(); i.hasNext(); )
+ for( Map.Entry<Integer,WeakReference<WatchDog>> e : c_kennel.entrySet() )
{
- Map.Entry e = (Map.Entry) i.next();
-
- WeakReference w = (WeakReference) e.getValue();
+ WeakReference w = e.getValue();
//
// Remove expired as well
@@ -263,7 +261,7 @@
{
synchronized( m_stateStack )
{
- State st = (State)m_stateStack.peek();
+ State st = m_stateStack.peek();
if( state == null || st.getState().equals(state) )
{
@@ -294,7 +292,7 @@
{
try
{
- WatchDog.State st = (WatchDog.State)m_stateStack.peek();
+ WatchDog.State st = m_stateStack.peek();
long now = System.currentTimeMillis();
@@ -329,7 +327,7 @@
try
{
- State st = (State) m_stateStack.peek();
+ State st = m_stateStack.peek();
state = st.getState();
}
catch( EmptyStackException e ) {}
@@ -374,13 +372,11 @@
{
synchronized( c_kennel )
{
- for( Iterator i = c_kennel.entrySet().iterator(); i.hasNext(); )
+ for( Map.Entry<Integer,WeakReference<WatchDog>> entry : c_kennel.entrySet() )
{
- Map.Entry entry = (Map.Entry) i.next();
-
- WeakReference wr = (WeakReference) entry.getValue();
+ WeakReference<WatchDog> wr = entry.getValue();
- WatchDog w = (WatchDog) wr.get();
+ WatchDog w = wr.get();
if( w != null )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/AbstractStep.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/AbstractStep.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/AbstractStep.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/AbstractStep.java Sat Feb 23 11:35:56 2008
@@ -45,13 +45,13 @@
private boolean m_completed;
- private final Map m_successors;
+ private final Map<Outcome,Step> m_successors;
private Workflow m_workflow;
private Outcome m_outcome;
- private final List m_errors;
+ private final List<String> m_errors;
private boolean m_started;
@@ -73,10 +73,10 @@
m_start = Workflow.TIME_NOT_SET;
m_completed = false;
m_end = Workflow.TIME_NOT_SET;
- m_errors = new ArrayList();
+ m_errors = new ArrayList<String>();
m_outcome = Outcome.STEP_CONTINUE;
m_key = messageKey;
- m_successors = new LinkedHashMap();
+ m_successors = new LinkedHashMap<Outcome,Step>();
}
/**
@@ -109,16 +109,15 @@
/**
* {@inheritDoc}
*/
- public final Collection getAvailableOutcomes()
+ public final Collection<Outcome> getAvailableOutcomes()
{
- Set outcomes = m_successors.keySet();
- return Collections.unmodifiableCollection( outcomes );
+ return Collections.unmodifiableCollection( m_successors.keySet() );
}
/**
* {@inheritDoc}
*/
- public final List getErrors()
+ public final List<String> getErrors()
{
return Collections.unmodifiableList( m_errors );
}
@@ -259,7 +258,7 @@
*/
public final Step getSuccessor( Outcome outcome )
{
- return (Step) m_successors.get( outcome );
+ return m_successors.get( outcome );
}
// --------------------------Helper methods--------------------------
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Decision.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Decision.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Decision.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Decision.java Sat Feb 23 11:35:56 2008
@@ -61,7 +61,7 @@
private final Outcome m_defaultOutcome;
- private final List m_facts;
+ private final List<Fact> m_facts;
/**
* Constructs a new Decision for a required "actor" Principal, having a default Outcome.
@@ -77,7 +77,7 @@
super(workflow, messageKey);
m_actor = actor;
m_defaultOutcome = defaultOutcome;
- m_facts = new ArrayList();
+ m_facts = new ArrayList<Fact>();
addSuccessor(defaultOutcome, null);
}
@@ -179,7 +179,7 @@
*
* @return the list of Facts
*/
- public final List getFacts()
+ public final List<Fact> getFacts()
{
return Collections.unmodifiableList(m_facts);
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/DecisionQueue.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/DecisionQueue.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/DecisionQueue.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/DecisionQueue.java Sat Feb 23 11:35:56 2008
@@ -22,7 +22,6 @@
import java.security.Principal;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.LinkedList;
import com.ecyrd.jspwiki.WikiException;
@@ -38,7 +37,7 @@
public class DecisionQueue
{
- private LinkedList m_queue = new LinkedList();
+ private LinkedList<Decision> m_queue = new LinkedList<Decision>();
private volatile int m_next;
@@ -73,7 +72,7 @@
*/
protected Decision[] decisions()
{
- return (Decision[]) m_queue.toArray(new Decision[m_queue.size()]);
+ return m_queue.toArray(new Decision[m_queue.size()]);
}
/**
@@ -96,17 +95,15 @@
* the wiki session
* @return the collection of Decisions, which may be empty
*/
- public Collection getActorDecisions(WikiSession session)
+ public Collection<Decision> getActorDecisions(WikiSession session)
{
- ArrayList decisions = new ArrayList();
+ ArrayList<Decision> decisions = new ArrayList<Decision>();
if (session.isAuthenticated())
{
Principal[] principals = session.getPrincipals();
Principal[] rolePrincipals = session.getRoles();
- for (Iterator it = m_queue.iterator(); it.hasNext();)
+ for ( Decision decision : m_queue )
{
- Decision decision = (Decision) it.next();
-
// Iterate through the Principal set
for (int i = 0; i < principals.length; i++)
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Workflow.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Workflow.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Workflow.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/Workflow.java Sat Feb 23 11:35:56 2008
@@ -224,7 +224,7 @@
public static final int CREATED = -2;
/** Lazily-initialized attribute map. */
- private Map m_attributes;
+ private Map<String,Object> m_attributes;
/** The initial Step for this Workflow. */
private Step m_firstStep;
@@ -232,7 +232,7 @@
/** Flag indicating whether the Workflow has started yet. */
private boolean m_started;
- private final LinkedList m_history;
+ private final LinkedList<Step> m_history;
private int m_id;
@@ -240,7 +240,7 @@
private final Principal m_owner;
- private final List m_messageArgs;
+ private final List<Object> m_messageArgs;
private int m_state;
@@ -267,11 +267,11 @@
super();
m_attributes = null;
m_currentStep = null;
- m_history = new LinkedList();
+ m_history = new LinkedList<Step>();
m_id = ID_NOT_SET;
m_key = messageKey;
m_manager = null;
- m_messageArgs = new ArrayList();
+ m_messageArgs = new ArrayList<Object>();
m_owner = owner;
m_started = false;
m_state = CREATED;
@@ -400,7 +400,7 @@
{
if (isCompleted())
{
- Step last = (Step) m_history.getLast();
+ Step last = m_history.getLast();
if (last != null)
{
return last.getEndTime();
@@ -441,7 +441,7 @@
*/
public final Object[] getMessageArguments()
{
- List args = new ArrayList();
+ List<Object> args = new ArrayList<Object>();
args.add(m_owner.getName());
Principal actor = getCurrentActor();
args.add(actor == null ? "-" : actor.getName());
@@ -602,7 +602,7 @@
{
if (m_attributes == null)
{
- m_attributes = new HashMap();
+ m_attributes = new HashMap<String,Object>();
}
m_attributes.put(attr, obj);
}
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowBuilder.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowBuilder.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowBuilder.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowBuilder.java Sat Feb 23 11:35:56 2008
@@ -32,7 +32,7 @@
*/
public final class WorkflowBuilder
{
- private static final Map BUILDERS = new HashMap();
+ private static final Map<WikiEngine,WorkflowBuilder> BUILDERS = new HashMap<WikiEngine,WorkflowBuilder>();
private final WikiEngine m_engine;
/**
@@ -52,7 +52,7 @@
*/
public static WorkflowBuilder getBuilder( WikiEngine engine )
{
- WorkflowBuilder builder = (WorkflowBuilder)BUILDERS.get( engine );
+ WorkflowBuilder builder = BUILDERS.get( engine );
if ( builder == null )
{
builder = new WorkflowBuilder( engine );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowManager.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowManager.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/workflow/WorkflowManager.java Sat Feb 23 11:35:56 2008
@@ -44,11 +44,11 @@
private final DecisionQueue m_queue = new DecisionQueue();
- private final Set m_workflows;
+ private final Set<Workflow> m_workflows;
- private final Map m_approvers;
+ private final Map<String,Principal> m_approvers;
- private final List m_completed;
+ private final List<Workflow> m_completed;
/** The prefix to use for looking up <code>jspwiki.properties</code> approval roles. */
protected static final String PROPERTY_APPROVER_PREFIX = "jspwiki.approver.";
@@ -60,9 +60,9 @@
public WorkflowManager()
{
m_next = 1;
- m_workflows = new HashSet();
- m_approvers = new HashMap();
- m_completed = new ArrayList();
+ m_workflows = new HashSet<Workflow>();
+ m_approvers = new HashMap<String,Principal>();
+ m_completed = new ArrayList<Workflow>();
}
/**
@@ -86,18 +86,18 @@
*
* @return the current workflows
*/
- public Collection getWorkflows()
+ public Collection<Workflow> getWorkflows()
{
- return new HashSet( m_workflows );
+ return new HashSet<Workflow>( m_workflows );
}
/**
* Returns a collection of finished workflows; that is, those that have aborted or completed.
* @return the finished workflows
*/
- public List getCompletedWorkflows()
+ public List<Workflow> getCompletedWorkflows()
{
- return new ArrayList( m_completed );
+ return new ArrayList<Workflow>( m_completed );
}
private WikiEngine m_engine = null;
@@ -171,7 +171,7 @@
*/
public Principal getApprover( String messageKey ) throws WikiException
{
- Principal approver = (Principal) m_approvers.get( messageKey );
+ Principal approver = m_approvers.get( messageKey );
if ( approver == null )
{
throw new WikiException( "Workflow '" + messageKey + "' does not require approval." );
@@ -242,15 +242,14 @@
* @param session the wiki session
* @return the collection workflows the wiki session owns, which may be empty
*/
- public Collection getOwnerWorkflows(WikiSession session)
+ public Collection<Workflow> getOwnerWorkflows(WikiSession session)
{
- List workflows = new ArrayList();
+ List<Workflow> workflows = new ArrayList<Workflow>();
if ( session.isAuthenticated() )
{
Principal[] sessionPrincipals = session.getPrincipals();
- for ( Iterator it = m_workflows.iterator(); it.hasNext(); )
+ for ( Workflow w : m_workflows )
{
- Workflow w = (Workflow)it.next();
Principal owner = w.getOwner();
for ( int i = 0; i < sessionPrincipals.length; i++ )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/AbstractRPCHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/AbstractRPCHandler.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/AbstractRPCHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/AbstractRPCHandler.java Sat Feb 23 11:35:56 2008
@@ -75,13 +75,13 @@
m_engine = context.getEngine();
}
- protected abstract Hashtable encodeWikiPage( WikiPage p );
+ protected abstract Hashtable<String,Object> encodeWikiPage( WikiPage p );
public Vector getRecentChanges( Date since )
{
checkPermission( PagePermission.VIEW );
- Collection pages = m_engine.getRecentChanges();
- Vector result = new Vector();
+ Collection<WikiPage> pages = m_engine.getRecentChanges();
+ Vector<Hashtable<String,Object>> result = new Vector<Hashtable<String,Object>>();
// Transform UTC into local time.
Calendar cal = Calendar.getInstance();
@@ -90,9 +90,8 @@
(cal.get( Calendar.ZONE_OFFSET ) +
(cal.getTimeZone().inDaylightTime( since ) ? cal.get( Calendar.DST_OFFSET ) : 0 )) );
- for( Iterator i = pages.iterator(); i.hasNext(); )
+ for( WikiPage page : pages )
{
- WikiPage page = (WikiPage)i.next();
if( page.getLastModified().after( cal.getTime() ) )
{
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/MetaWeblogHandler.java Sat Feb 23 11:35:56 2008
@@ -21,6 +21,8 @@
import java.io.*;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.attachment.AttachmentManager;
import com.ecyrd.jspwiki.plugin.WeblogEntryPlugin;
@@ -50,9 +52,11 @@
Logger log = Logger.getLogger( MetaWeblogHandler.class );
private WikiEngine m_engine;
+ private WikiContext m_context;
public void initialize( WikiContext context )
{
+ m_context = context;
m_engine = context.getEngine();
}
@@ -127,7 +131,7 @@
private String getURL( String page )
{
- return m_engine.getURL( WikiContext.VIEW,
+ return m_context.getContext().getURL( ViewActionBean.class,
page,
null,
true ); // Force absolute urls
@@ -139,9 +143,9 @@
* @param page The actual entry page
* @return A metaWeblog entry struct.
*/
- private Hashtable makeEntry( WikiPage page )
+ private Hashtable<String,Object> makeEntry( WikiPage page )
{
- Hashtable ht = new Hashtable();
+ Hashtable<String,Object> ht = new Hashtable<String,Object>();
WikiPage firstVersion = m_engine.getPage( page.getName(), 1 );
@@ -184,7 +188,7 @@
int numberOfPosts)
throws XmlRpcException
{
- Hashtable result = new Hashtable();
+ Hashtable<String,Object> result = new Hashtable<String,Object>();
log.info( "metaWeblog.getRecentPosts() called");
@@ -196,7 +200,7 @@
{
WeblogPlugin plugin = new WeblogPlugin();
- List changed = plugin.findBlogEntries(m_engine.getPageManager(),
+ List<WikiPage> changed = plugin.findBlogEntries(m_engine.getPageManager(),
blogid,
new Date(0L),
new Date());
@@ -247,7 +251,7 @@
WikiPage entryPage = new WikiPage( m_engine, pageName );
entryPage.setAuthor( username );
- WikiContext context = new WikiContext( m_engine, entryPage );
+ WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( entryPage );
StringBuffer text = new StringBuffer();
text.append( "!"+content.get("title") );
@@ -296,7 +300,7 @@
att.setAuthor( username );
attmgr.storeAttachment( att, new ByteArrayInputStream( data ) );
- url = m_engine.getURL( WikiContext.ATTACH, att.getName(), null, true );
+ url = m_context.getContext().getURL( AttachActionBean.class, att.getName(), null, true );
}
catch( Exception e )
{
@@ -304,7 +308,7 @@
throw new XmlRpcException( 0, "Failed to upload media object: "+e.getMessage() );
}
- Hashtable result = new Hashtable();
+ Hashtable<String,String> result = new Hashtable<String,String>();
result.put("url", url);
return result;
@@ -334,7 +338,7 @@
WikiPage entryPage = (WikiPage)page.clone();
entryPage.setAuthor( username );
- WikiContext context = new WikiContext( m_engine, entryPage );
+ WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( entryPage );
StringBuffer text = new StringBuffer();
text.append( "!"+content.get("title") );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandler.java Sat Feb 23 11:35:56 2008
@@ -26,6 +26,9 @@
import org.apache.xmlrpc.XmlRpcException;
import com.ecyrd.jspwiki.*;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.EditActionBean;
+import com.ecyrd.jspwiki.action.ViewActionBean;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.auth.permissions.PagePermission;
import com.ecyrd.jspwiki.auth.permissions.PermissionFactory;
@@ -43,6 +46,8 @@
extends AbstractRPCHandler
{
Logger log = Logger.getLogger( RPCHandler.class );
+
+ private static final Map<String,String> NO_PARAMS = Collections.unmodifiableMap( new HashMap<String,String>() );
public void initialize( WikiContext ctx )
{
@@ -95,12 +100,11 @@
public Vector getAllPages()
{
checkPermission( PagePermission.VIEW );
- Collection pages = m_engine.getRecentChanges();
- Vector result = new Vector();
+ Collection<WikiPage> pages = m_engine.getRecentChanges();
+ Vector<String> result = new Vector<String>();
- for( Iterator i = pages.iterator(); i.hasNext(); )
+ for( WikiPage p : pages )
{
- WikiPage p = (WikiPage) i.next();
if( !(p instanceof Attachment) )
{
result.add( toRPCString(p.getName()) );
@@ -113,9 +117,9 @@
/**
* Encodes a single wiki page info into a Hashtable.
*/
- protected Hashtable encodeWikiPage( WikiPage page )
+ protected Hashtable<String,Object> encodeWikiPage( WikiPage page )
{
- Hashtable ht = new Hashtable();
+ Hashtable<String,Object> ht = new Hashtable<String,Object>();
ht.put( "name", toRPCString(page.getName()) );
@@ -145,11 +149,11 @@
return ht;
}
- public Vector getRecentChanges( Date since )
+ public Vector<Hashtable<String,Object>> getRecentChanges( Date since )
{
checkPermission( PagePermission.VIEW );
- Collection pages = m_engine.getRecentChanges();
- Vector result = new Vector();
+ Collection<WikiPage> pages = m_engine.getRecentChanges();
+ Vector<Hashtable<String,Object>> result = new Vector<Hashtable<String,Object>>();
Calendar cal = Calendar.getInstance();
cal.setTime( since );
@@ -162,10 +166,8 @@
(cal.getTimeZone().inDaylightTime(since) ? cal.get( Calendar.DST_OFFSET ) : 0 ) ) );
since = cal.getTime();
- for( Iterator i = pages.iterator(); i.hasNext(); )
+ for( WikiPage page : pages )
{
- WikiPage page = (WikiPage)i.next();
-
if( page.getLastModified().after( since ) && !(page instanceof Attachment) )
{
result.add( encodeWikiPage( page ) );
@@ -261,7 +263,7 @@
LinkCollector extCollector = new LinkCollector();
LinkCollector attCollector = new LinkCollector();
- WikiContext context = new WikiContext( m_engine, page );
+ WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( page );
context.setVariable( WikiEngine.PROP_REFSTYLE, "absolute" );
m_engine.textToHTML( context,
@@ -270,15 +272,14 @@
extCollector,
attCollector );
- Vector result = new Vector();
+ Vector<Hashtable<String,String>> result = new Vector<Hashtable<String,String>>();
//
// Add local links.
//
- for( Iterator i = localCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : localCollector.getLinks() )
{
- String link = (String) i.next();
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", toRPCString( link ) );
ht.put( "type", LINK_LOCAL );
@@ -295,11 +296,11 @@
if( m_engine.pageExists(link) )
{
- ht.put( "href", context.getURL(WikiContext.VIEW,link) );
+ ht.put( "href", context.getContext().getURL( ViewActionBean.class, link, NO_PARAMS, true ) );
}
else
{
- ht.put( "href", context.getURL(WikiContext.EDIT,link) );
+ ht.put( "href", context.getContext().getURL( EditActionBean.class, link, NO_PARAMS, true ) );
}
result.add( ht );
@@ -308,15 +309,13 @@
//
// Add links to inline attachments
//
- for( Iterator i = attCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : attCollector.getLinks() )
{
- String link = (String) i.next();
-
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", toRPCString( link ) );
ht.put( "type", LINK_LOCAL );
- ht.put( "href", context.getURL(WikiContext.ATTACH,link) );
+ ht.put( "href", context.getContext().getURL( AttachActionBean.class, link, NO_PARAMS, true ) );
result.add( ht );
}
@@ -326,11 +325,9 @@
// simply because URLs are by definition ASCII.
//
- for( Iterator i = extCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : extCollector.getLinks() )
{
- String link = (String) i.next();
-
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", link );
ht.put( "type", LINK_EXTERNAL );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCHandlerUTF8.java Sat Feb 23 11:35:56 2008
@@ -27,6 +27,8 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
import com.ecyrd.jspwiki.WikiPage;
+import com.ecyrd.jspwiki.action.AttachActionBean;
+import com.ecyrd.jspwiki.action.EditActionBean;
import com.ecyrd.jspwiki.attachment.Attachment;
import com.ecyrd.jspwiki.auth.permissions.PagePermission;
import com.ecyrd.jspwiki.auth.permissions.PermissionFactory;
@@ -53,13 +55,11 @@
{
checkPermission( PagePermission.VIEW );
- Collection pages = m_engine.getRecentChanges();
- Vector result = new Vector();
+ Collection<WikiPage> pages = m_engine.getRecentChanges();
+ Vector<String> result = new Vector<String>();
- for( Iterator i = pages.iterator(); i.hasNext(); )
+ for( WikiPage p : pages )
{
- WikiPage p = (WikiPage) i.next();
-
if( !(p instanceof Attachment) )
{
result.add( p.getName() );
@@ -72,9 +72,9 @@
/**
* Encodes a single wiki page info into a Hashtable.
*/
- protected Hashtable encodeWikiPage( WikiPage page )
+ protected Hashtable<String,Object> encodeWikiPage( WikiPage page )
{
- Hashtable ht = new Hashtable();
+ Hashtable<String,Object> ht = new Hashtable<String,Object>();
ht.put( "name", page.getName() );
@@ -104,12 +104,12 @@
return ht;
}
- public Vector getRecentChanges( Date since )
+ public Vector<Hashtable<String,Object>> getRecentChanges( Date since )
{
checkPermission( PagePermission.VIEW );
- Collection pages = m_engine.getRecentChanges();
- Vector result = new Vector();
+ Collection<WikiPage> pages = m_engine.getRecentChanges();
+ Vector<Hashtable<String,Object>> result = new Vector<Hashtable<String,Object>>();
Calendar cal = Calendar.getInstance();
cal.setTime( since );
@@ -122,10 +122,8 @@
(cal.getTimeZone().inDaylightTime(since) ? cal.get( Calendar.DST_OFFSET ) : 0 ) ) );
since = cal.getTime();
- for( Iterator i = pages.iterator(); i.hasNext(); )
+ for( WikiPage page : pages )
{
- WikiPage page = (WikiPage)i.next();
-
if( page.getLastModified().after( since ) && !(page instanceof Attachment) )
{
result.add( encodeWikiPage( page ) );
@@ -219,7 +217,7 @@
LinkCollector extCollector = new LinkCollector();
LinkCollector attCollector = new LinkCollector();
- WikiContext context = new WikiContext( m_engine, page );
+ WikiContext context = m_engine.getWikiActionBeanFactory().newViewActionBean( page );
context.setVariable( WikiEngine.PROP_REFSTYLE, "absolute" );
m_engine.textToHTML( context,
@@ -228,17 +226,16 @@
extCollector,
attCollector );
- Vector result = new Vector();
+ Vector<Hashtable<String,String>> result = new Vector<Hashtable<String,String>>();
// FIXME: Contains far too much common with RPCHandler. Refactor!
//
// Add local links.
//
- for( Iterator i = localCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : localCollector.getLinks() )
{
- String link = (String) i.next();
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", link );
ht.put( "type", LINK_LOCAL );
@@ -248,7 +245,7 @@
}
else
{
- ht.put( "href", context.getURL(WikiContext.EDIT,link) );
+ ht.put( "href", context.getContext().getURL(EditActionBean.class,link) );
}
result.add( ht );
@@ -257,15 +254,13 @@
//
// Add links to inline attachments
//
- for( Iterator i = attCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : attCollector.getLinks() )
{
- String link = (String) i.next();
-
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", link );
ht.put( "type", LINK_LOCAL );
- ht.put( "href", context.getURL(WikiContext.ATTACH,link) );
+ ht.put( "href", context.getContext().getURL(AttachActionBean.class,link) );
result.add( ht );
}
@@ -275,11 +270,9 @@
// simply because URLs are by definition ASCII.
//
- for( Iterator i = extCollector.getLinks().iterator(); i.hasNext(); )
+ for( String link : extCollector.getLinks() )
{
- String link = (String) i.next();
-
- Hashtable ht = new Hashtable();
+ Hashtable<String,String> ht = new Hashtable<String,String>();
ht.put( "page", link );
ht.put( "type", LINK_EXTERNAL );
Modified: incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java?rev=630515&r1=630514&r2=630515&view=diff
==============================================================================
--- incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java (original)
+++ incubator/jspwiki/branches/JSPWIKI_2_9_STRIPES_BRANCH/src/com/ecyrd/jspwiki/xmlrpc/RPCServlet.java Sat Feb 23 11:35:56 2008
@@ -36,6 +36,8 @@
import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.WikiEngine;
+import com.ecyrd.jspwiki.WikiException;
+import com.ecyrd.jspwiki.action.ViewActionBean;
/**
* Handles all incoming servlet requests for XML-RPC calls.
@@ -74,7 +76,7 @@
rpchandler.initialize( m_engine );
m_xmlrpcServer.addHandler( prefix, rpchandler );
*/
- Class handlerClass = Class.forName( handlerName );
+ Class<?> handlerClass = Class.forName( handlerName );
m_xmlrpcServer.addHandler( prefix, new LocalHandler(handlerClass) );
}
@@ -120,8 +122,16 @@
try
{
- WikiContext ctx = m_engine.createContext( request, WikiContext.NONE );
-
+ WikiContext ctx;
+ try
+ {
+ ctx = (WikiContext)m_engine.getWikiActionBeanFactory().newActionBean( request, response, ViewActionBean.class );
+ }
+ catch ( WikiException e )
+ {
+ throw new ServletException( e.getMessage() );
+ }
+
XmlRpcContext xmlrpcContext = new WikiXmlRpcContext( m_xmlrpcServer.getHandlerMapping(),
ctx );
@@ -178,9 +188,9 @@
private class LocalHandler
implements ContextXmlRpcHandler
{
- private Class m_clazz;
+ private Class<?> m_clazz;
- public LocalHandler( Class clazz )
+ public LocalHandler( Class<?> clazz )
{
m_clazz = clazz;
}