shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kao...@apache.org
Subject svn commit: r912299 - in /incubator/shiro/trunk: core/src/main/java/org/apache/shiro/aop/ support/aspectj/src/main/java/org/apache/shiro/aspectj/ support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/
Date Sun, 21 Feb 2010 06:20:49 GMT
Author: kaosko
Date: Sun Feb 21 06:20:49 2010
New Revision: 912299

URL: http://svn.apache.org/viewvc?rev=912299&view=rev
Log:
Complete - issue SHIRO-124: MethodInvocation is missing a getThis() (or equivalent) method

http://issues.apache.org/jira/browse/SHIRO-124
- Added getThis(). Both AspectJ and and aopalliance are using getThis() naming so I didn't
see any need to change it

Modified:
    incubator/shiro/trunk/core/src/main/java/org/apache/shiro/aop/MethodInvocation.java
    incubator/shiro/trunk/support/aspectj/src/main/java/org/apache/shiro/aspectj/BeforeAdviceMethodInvocationAdapter.java
    incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.java

Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/aop/MethodInvocation.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/aop/MethodInvocation.java?rev=912299&r1=912298&r2=912299&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/aop/MethodInvocation.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/aop/MethodInvocation.java Sun
Feb 21 06:20:49 2010
@@ -70,6 +70,14 @@
      * @return the (possibly null) arguments to be supplied to the method invocation.
      */
     Object[] getArguments();
+    
+    /**
+     * Returns the object that holds the current joinpoint's static part.
+     * For instance, the target object for an invocation.
+     *      
+     * @return the object that holds the current joinpoint's static part.
+     */
+    Object getThis();
 
 
 }

Modified: incubator/shiro/trunk/support/aspectj/src/main/java/org/apache/shiro/aspectj/BeforeAdviceMethodInvocationAdapter.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/aspectj/src/main/java/org/apache/shiro/aspectj/BeforeAdviceMethodInvocationAdapter.java?rev=912299&r1=912298&r2=912299&view=diff
==============================================================================
--- incubator/shiro/trunk/support/aspectj/src/main/java/org/apache/shiro/aspectj/BeforeAdviceMethodInvocationAdapter.java
(original)
+++ incubator/shiro/trunk/support/aspectj/src/main/java/org/apache/shiro/aspectj/BeforeAdviceMethodInvocationAdapter.java
Sun Feb 21 06:20:49 2010
@@ -15,12 +15,13 @@
  */
 public class BeforeAdviceMethodInvocationAdapter implements MethodInvocation {
 
+  private Object _object;
   private Method _method;
   private Object[] _arguments;
 
   /**
    * Factory method that creates a new {@link BeforeAdviceMethodInvocationAdapter} instance
-   * using the AspectJ {@link JoinPoint} provided. The the joint point passed in is not
+   * using the AspectJ {@link JoinPoint} provided. If the joint point passed in is not
    * a method joint point, this method throws an {@link IllegalArgumentException}.
    * 
    * @param aJoinPoint The AspectJ {@link JoinPoint} to use to adapt the advice.
@@ -29,12 +30,12 @@
    */
   public static BeforeAdviceMethodInvocationAdapter createFrom(JoinPoint aJoinPoint) {
     if (aJoinPoint.getSignature() instanceof MethodSignature) {
-      return new BeforeAdviceMethodInvocationAdapter(
+      return new BeforeAdviceMethodInvocationAdapter(aJoinPoint.getThis(),
               ((MethodSignature) aJoinPoint.getSignature()).getMethod(),
               aJoinPoint.getArgs());
       
     } else if (aJoinPoint.getSignature() instanceof AdviceSignature) {
-      return new BeforeAdviceMethodInvocationAdapter(
+      return new BeforeAdviceMethodInvocationAdapter(aJoinPoint.getThis(),
               ((AdviceSignature) aJoinPoint.getSignature()).getAdvice(),
               aJoinPoint.getArgs());
       
@@ -49,7 +50,8 @@
    * @param aMethod The method to invoke.
    * @param someArguments The arguments of the method invocation.
    */
-  public BeforeAdviceMethodInvocationAdapter(Method aMethod, Object[] someArguments) {
+  public BeforeAdviceMethodInvocationAdapter(Object anObject, Method aMethod, Object[] someArguments)
{
+    _object = anObject;
     _method = aMethod;
     _arguments = someArguments;
   }
@@ -75,4 +77,8 @@
     // Do nothing since this adapts a before advice
     return null;
   }
+
+  public Object getThis() {
+    return _object;
+  }
 }

Modified: incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.java?rev=912299&r1=912298&r2=912299&view=diff
==============================================================================
--- incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.java
(original)
+++ incubator/shiro/trunk/support/spring/src/main/java/org/apache/shiro/spring/security/interceptor/AopAllianceAnnotationsAuthorizingMethodInterceptor.java
Sun Feb 21 06:20:49 2010
@@ -63,6 +63,10 @@
             public Object proceed() throws Throwable {
                 return mi.proceed();
             }
+
+	    public Object getThis() {
+		return mi.getThis();
+	    }
         };
     }
 



Mime
View raw message