Results 1 to 4 of 4

Thread: can asjectJ handle the "block everything except certain call path pattern" ?

  1. #1

    Default can asjectJ handle the "block everything except certain call path pattern" ?

    Hi,

    suppose I have a DAO class:

    class DAO {
    ... access methods...
    }

    and a specific controller class(say user info maintainance):

    class MySpecificController {
    DAO dao;
    public updateUser() {
    dao.update(userInfo);
    }
    }

    Currently, I have a pointcut that basically block/check DAO.* and deny/limits read/write.

    What I would like to do is that if the access is from within MySpecficController, I would let go of this constrain.

    For the above simple case, I can use "call(public * DAO.*(..))" and access the pjp.getThis() which should be MySpecificController something.

    But if I have a case like this :

    MySpcificController.someMethod -> some genericClass.Method -> ... -> DAO.method. That is the access may not be a direct call but going through certain layer which ends up in the method I trap.

    How would I be able to know that it is done in the 'allowable call path' and lex the constraint ?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    Read the documentation about the within and this keyword for AspectJ expression language.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    I have read that but it is not very clear on what these two are supposed to do. pjp.getThis() seems to be equivalent to this() as far as my test show and I am not sure within works my case case.

    It seems that within would only work if I use the call() form but not the execution() form.

    even the following pointcut(which is supposed to stop infinite loop because my aspect needs to access certain function of GenericDao) doesn't work:

    execution(public * something.GenericDao.*(..)) && !within(MyAspect)

    It ends up in stack overflow. I tried both the full (org.gng.MyAspect) and (MyAspect), both gives the same result.

  4. #4

    Default

    cflow or cflowbelow is supposed to be the solution, except that it suffers from the same problem as mentioned here :

    http://forum.springframework.org/showthread.php?t=31872

    So, it seems that at the moment, there is no solution for this pattern.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •