Gabriel for Guice

After fiddling around with the security framework Gabriel I wrote some time back and which I need for Reposita. I thought about combining Gabriel with Google Guice for fun. The only problem was that Gabriel can be used with interceptors to protect methods. How could I get them working with Guice?

I was using Dynaop, the best aop framework for Java, which I wrote a Spring bean factory for to use with Gabriel. For Guice I tried to port it when Bob told me that Guice already supports interceptors 🙂 So using my AOP alliance interceptors from Gabriel with Guice was a no brainer. Everything worked as excpected. Guice is great.

So protecting methods with annotations is easy now with Gabriel:

public interface SecureObject {

  @NeedsPermission("SET_NAME")  
  public void setName(String name);
}

Two things I'm still thinking about are what to call the annotation ? NeedsPermission, Permission, WithPermission? And to get the interface method I currently iterate over all interfaces of the class, any ideas how to do that faster?

Otherwise: http://gabriel.reposita.org/