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 2013/02/08 22:10:30 UTC

svn commit: r1444240 - in /incubator/jspwiki/trunk: ./ doc/ src/org/apache/wiki/ src/org/apache/wiki/auth/authorize/ src/org/apache/wiki/event/ src/org/apache/wiki/workflow/ tests/org/apache/wiki/auth/

Author: juanpablo
Date: Fri Feb  8 21:10:30 2013
New Revision: 1444240

URL: http://svn.apache.org/r1444240
Log:
  * Decoupled (for 2.10 scope) org.apache.wiki.event from org.apache.wiki.workflow, by deprecating
     -> WorkflowEvent#getWorkflow() in favour of WikiEvent#getSrc()

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/doc/2.10-API.txt
    incubator/jspwiki/trunk/src/org/apache/wiki/WikiSession.java
    incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/GroupManager.java
    incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiEvent.java
    incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiSecurityEvent.java
    incubator/jspwiki/trunk/src/org/apache/wiki/event/WorkflowEvent.java
    incubator/jspwiki/trunk/src/org/apache/wiki/workflow/WorkflowManager.java
    incubator/jspwiki/trunk/tests/org/apache/wiki/auth/GroupManagerTest.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Fri Feb  8 21:10:30 2013
@@ -2,8 +2,8 @@
 
        * 2.9.1-svn-24
        
-       * Decoupled Preferences from WikiContext, effectively meaning that the following methods are 
-         now deprecated
+       * Decoupled (for 2.10 scope) Preferences from WikiContext, effectively meaning that the following 
+         methods are now deprecated
           -> WikiContext#getBundle( String ) in favour of Preferences#getBundle( WikiContext, String )
           -> WikiContext#getLocale( WikiContext ) in favour of Preferences#getLocale( WikiContext )
           -> WikiContext#hasAccess( HttpServletResponse ) in favour of 
@@ -11,6 +11,9 @@
           -> WikiContext#hasAccess( HttpServletResponse, boolean ) in favour of 
              AuthorizationManager#hasAccess( HttpServletResponse, boolean )
              
+       * Decoupled (for 2.10 scope) org.apache.wiki.event from org.apache.wiki.workflow, by deprecating
+          -> WorkflowEvent#getWorkflow() in favour of WikiEvent#getSrc()
+             
        * Added latest pom.xml from JSPWIKI-651 - Convert JSPWiki to a Maven project. Check associated
          JIRA for details
 

Modified: incubator/jspwiki/trunk/doc/2.10-API.txt
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/doc/2.10-API.txt?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/doc/2.10-API.txt (original)
+++ incubator/jspwiki/trunk/doc/2.10-API.txt Fri Feb  8 21:10:30 2013
@@ -52,7 +52,10 @@ org.apache.wiki.WikiEngine
 org.apache.wiki.FileUtil and org.apache.wiki.TextUtil
  -> Moved to org.apache.wiki.util.FileUtil and org.apache.wiki.util.TextUtil respectively
  -> original classes marked with @Deprecated and forwarding to the new ones until 2.10
-       
+
+org.apache.wiki.event.WorkflowEvent
+ -> @Deprecated getWorkflow() in favour of the generified WikiEvent#getSrc()
+
 org.apache.wiki.filters.FilterManager
  -> new interface org.apache.wiki.api.engine.FilterManager
  -> moved to org.apache.wiki.filters.DefaultFilterManager

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/WikiSession.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/WikiSession.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/WikiSession.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/WikiSession.java Fri Feb  8 21:10:30 2013
@@ -545,7 +545,7 @@ public final class WikiSession implement
                     }
                     case WikiSecurityEvent.PROFILE_SAVE:
                     {
-                        WikiSession source = (WikiSession)e.getSource();
+                        WikiSession source = e.getSrc();
                         if ( this.equals( source ) )
                         {
                             injectUserProfilePrincipals();  // Add principals for the user profile
@@ -556,7 +556,7 @@ public final class WikiSession implement
                     case WikiSecurityEvent.PROFILE_NAME_CHANGED:
                     {
                         // Refresh user principals based on new user profile
-                        WikiSession source = (WikiSession)e.getSource();
+                        WikiSession source = e.getSrc();
                         if ( this.equals( source ) && m_status == AUTHENTICATED )
                         {
                             // To prepare for refresh, set the new full name as the primary principal

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/GroupManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/GroupManager.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/GroupManager.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/auth/authorize/GroupManager.java Fri Feb  8 21:10:30 2013
@@ -693,7 +693,7 @@ public final class GroupManager implemen
         WikiSecurityEvent se = (WikiSecurityEvent)event;
         if ( se.getType() == WikiSecurityEvent.PROFILE_NAME_CHANGED )
         {
-            WikiSession session = (WikiSession)se.getSource();
+            WikiSession session = se.getSrc();
             UserProfile[] profiles = (UserProfile[])se.getTarget();
             Principal[] oldPrincipals = new Principal[] {
                 new WikiPrincipal( profiles[0].getLoginName() ),

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiEvent.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiEvent.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiEvent.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiEvent.java Fri Feb  8 21:10:30 2013
@@ -54,6 +54,17 @@ public abstract class WikiEvent extends 
         m_when = System.currentTimeMillis();
         setType( type );
     }
+    
+    /**
+     * Convenience method that returns the typed object to which the event applied.
+     * 
+     * @return the typed object to which the event applied.
+     */
+    @SuppressWarnings("unchecked")
+    public <T> T getSrc()
+    {
+        return (T) super.getSource();
+    }
 
 
     /**

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiSecurityEvent.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiSecurityEvent.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiSecurityEvent.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/event/WikiSecurityEvent.java Fri Feb  8 21:10:30 2013
@@ -210,7 +210,7 @@ public final class WikiSecurityEvent ext
         StringBuffer msg = new StringBuffer();
         msg.append( "WikiSecurityEvent." );
         msg.append(  eventName( getType() ) );
-        msg.append( " [source=" + getSource().toString() );
+        msg.append( " [source=" + getSrc().toString() );
         if( m_principal != null )
         {
             msg.append( ", princpal=" + m_principal.getClass().getName() );

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/event/WorkflowEvent.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/event/WorkflowEvent.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/event/WorkflowEvent.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/event/WorkflowEvent.java Fri Feb  8 21:10:30 2013
@@ -91,10 +91,12 @@ public final class WorkflowEvent extends
      * Convenience method that returns the Workflow to which the event applied.
      * 
      * @return the Workflow
+     * @deprecated will be removed in 2.10 scope. Consider using {@link WikiEvent#getSrc()} instead
      */
+    @Deprecated
     public final Workflow getWorkflow()
     {
-        return (Workflow) super.getSource();
+        return (Workflow) super.getSrc();
     }
 
     /**
@@ -107,7 +109,7 @@ public final class WorkflowEvent extends
         StringBuffer msg = new StringBuffer();
         msg.append("WorkflowEvent.");
         msg.append(eventName(getType()));
-        msg.append(" [source=" + getSource().toString());
+        msg.append(" [source=" + getSrc().toString());
         msg.append("]");
         return msg.toString();
     }

Modified: incubator/jspwiki/trunk/src/org/apache/wiki/workflow/WorkflowManager.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/org/apache/wiki/workflow/WorkflowManager.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/org/apache/wiki/workflow/WorkflowManager.java (original)
+++ incubator/jspwiki/trunk/src/org/apache/wiki/workflow/WorkflowManager.java Fri Feb  8 21:10:30 2013
@@ -276,7 +276,7 @@ public class WorkflowManager implements 
     {
         if (event instanceof WorkflowEvent)
         {
-            Workflow workflow = (Workflow) event.getSource();
+            Workflow workflow = event.getSrc();
             switch ( event.getType() )
             {
                 case WorkflowEvent.ABORTED:

Modified: incubator/jspwiki/trunk/tests/org/apache/wiki/auth/GroupManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/tests/org/apache/wiki/auth/GroupManagerTest.java?rev=1444240&r1=1444239&r2=1444240&view=diff
==============================================================================
--- incubator/jspwiki/trunk/tests/org/apache/wiki/auth/GroupManagerTest.java (original)
+++ incubator/jspwiki/trunk/tests/org/apache/wiki/auth/GroupManagerTest.java Fri Feb  8 21:10:30 2013
@@ -196,7 +196,7 @@ public class GroupManagerTest extends Te
         WikiSecurityEvent[] events = m_trap.events();
         assertEquals( 1, events.length );
         event = events[0];
-        assertEquals( m_groupMgr, event.getSource() );
+        assertEquals( m_groupMgr, event.getSrc() );
         assertEquals( WikiSecurityEvent.GROUP_ADD, event.getType() );
         assertEquals( group, event.getTarget() );