// Path: src/main/java/act/aaa/event/AAAInitialized.java
// public class AAAInitialized extends ActEvent<AAAInitialized> {
// }
// 
// Path: src/main/java/act/aaa/util/AAAAdaptor.java
// public class AAAAdaptor extends ActAAAService.Base {
// 
//     private boolean passwordTypeIsCharArray;
//     private Method passwordVerifier;
//     private Method roleProviderMethod;
//     private Method permissionProviderMethod;
//     private Method privilegeProviderMethod;
// 
//     public AAAAdaptor(Class userType, boolean passwordTypeIsCharArray, Method passwordVerifier, Method roleProviderMethod, Method permissionProviderMethod, Method privilegeProviderMethod) {
//         super(userType);
//         this.passwordTypeIsCharArray = passwordTypeIsCharArray;
//         this.passwordVerifier = passwordVerifier;
//         this.roleProviderMethod = roleProviderMethod;
//         this.permissionProviderMethod = permissionProviderMethod;
//         this.privilegeProviderMethod = privilegeProviderMethod;
//     }
// 
//     @Override
//     protected boolean verifyPassword(Object user, char[] password) {
//         if (passwordTypeIsCharArray) {
//             return $.invokeVirtual(user, passwordVerifier, password);
//         } else {
//             String passwordStr = new String(password);
//             return $.invokeVirtual(user, passwordVerifier, passwordStr);
//         }
//     }
// 
//     @Override
//     protected Set<String> rolesOf(Object user) {
//         if (null == roleProviderMethod) {
//             return C.Set();
//         }
//         String roles = $.invokeVirtual(user, roleProviderMethod);
//         if (S.blank(roles)) {
//             return C.Set();
//         }
//         return C.Set(S.fastSplit(roles, StringTokenSet.SEPARATOR));
//     }
// 
//     @Override
//     protected Set<String> permissionsOf(Object user) {
//         if (null == permissionProviderMethod) {
//             return C.Set();
//         }
//         String permissions = $.invokeVirtual(user, permissionProviderMethod);
//         if (S.blank(permissions)) {
//             return C.Set();
//         }
//         return C.Set(S.fastSplit(permissions, StringTokenSet.SEPARATOR));
//     }
// 
//     @Override
//     protected Integer privilegeOf(Object user) {
//         if (null == privilegeProviderMethod) {
//             return null;
//         }
//         Object o = $.invokeVirtual(user, privilegeProviderMethod);
//         if (null == o) {
//             return null;
//         }
//         if (o instanceof Integer) {
//             return (Integer) o;
//         }
//         Privilege p = AAALookup.privilege((String) o);
//         return null == p ? null : p.getLevel();
//     }
// 
// }


import org.osgl.aaa.*;
import org.osgl.aaa.impl.DumbAuditor;
import org.osgl.util.E;
import javax.inject.Inject;
import java.lang.reflect.Method;
import java.util.EventObject;
import act.Act;
import act.aaa.event.AAAInitialized;
import act.aaa.util.AAAAdaptor;
import act.app.App;
import act.app.event.SysEventId;
import act.event.ActEventListenerBase;
import act.job.OnAppStart;
import act.util.LogSupport;
import act.util.Stateless;
import act.util.SubClassFinder;
        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuditorService(Class<Auditor> auditorClass) {
        if (DumbAuditor.class.equals(auditorClass) || DefaultAuditor.class.getName().equals(auditorClass.getName())) {
            return;
        }
        Auditor auditor = app.getInstance(auditorClass);
        plugin().buildService(app, auditor);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuthenticationService(Class<AuthenticationService> serviceType) {
        if (ActAAAService.class.isAssignableFrom(serviceType)) {
            return;
        }
        AuthenticationService service = app.getInstance(serviceType);
        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuthorizationService(Class<AuthorizationService> serviceType) {
        AuthorizationService service = app.getInstance(serviceType);
        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundDynamicPermissionCheckHelper(final Class<DynamicPermissionCheckHelperBase> target) {
        final DynamicPermissionCheckHelperBase helper = app.getInstance(target);
// Path: src/main/java/act/aaa/event/AAAInitialized.java
// public class AAAInitialized extends ActEvent<AAAInitialized> {
// }
// 
// Path: src/main/java/act/aaa/util/AAAAdaptor.java
// public class AAAAdaptor extends ActAAAService.Base {
// 
//     private boolean passwordTypeIsCharArray;
//     private Method passwordVerifier;
//     private Method roleProviderMethod;
//     private Method permissionProviderMethod;
//     private Method privilegeProviderMethod;
// 
//     public AAAAdaptor(Class userType, boolean passwordTypeIsCharArray, Method passwordVerifier, Method roleProviderMethod, Method permissionProviderMethod, Method privilegeProviderMethod) {
//         super(userType);
//         this.passwordTypeIsCharArray = passwordTypeIsCharArray;
//         this.passwordVerifier = passwordVerifier;
//         this.roleProviderMethod = roleProviderMethod;
//         this.permissionProviderMethod = permissionProviderMethod;
//         this.privilegeProviderMethod = privilegeProviderMethod;
//     }
// 
//     @Override
//     protected boolean verifyPassword(Object user, char[] password) {
//         if (passwordTypeIsCharArray) {
//             return $.invokeVirtual(user, passwordVerifier, password);
//         } else {
//             String passwordStr = new String(password);
//             return $.invokeVirtual(user, passwordVerifier, passwordStr);
//         }
//     }
// 
//     @Override
//     protected Set<String> rolesOf(Object user) {
//         if (null == roleProviderMethod) {
//             return C.Set();
//         }
//         String roles = $.invokeVirtual(user, roleProviderMethod);
//         if (S.blank(roles)) {
//             return C.Set();
//         }
//         return C.Set(S.fastSplit(roles, StringTokenSet.SEPARATOR));
//     }
// 
//     @Override
//     protected Set<String> permissionsOf(Object user) {
//         if (null == permissionProviderMethod) {
//             return C.Set();
//         }
//         String permissions = $.invokeVirtual(user, permissionProviderMethod);
//         if (S.blank(permissions)) {
//             return C.Set();
//         }
//         return C.Set(S.fastSplit(permissions, StringTokenSet.SEPARATOR));
//     }
// 
//     @Override
//     protected Integer privilegeOf(Object user) {
//         if (null == privilegeProviderMethod) {
//             return null;
//         }
//         Object o = $.invokeVirtual(user, privilegeProviderMethod);
//         if (null == o) {
//             return null;
//         }
//         if (o instanceof Integer) {
//             return (Integer) o;
//         }
//         Privilege p = AAALookup.privilege((String) o);
//         return null == p ? null : p.getLevel();
//     }
// 
// }


// Path: src/main/java/act/aaa/AAAServiceFinder.java
import org.osgl.aaa.*;
import org.osgl.aaa.impl.DumbAuditor;
import org.osgl.util.E;
import javax.inject.Inject;
import java.lang.reflect.Method;
import java.util.EventObject;
import act.Act;
import act.aaa.event.AAAInitialized;
import act.aaa.util.AAAAdaptor;
import act.app.App;
import act.app.event.SysEventId;
import act.event.ActEventListenerBase;
import act.job.OnAppStart;
import act.util.LogSupport;
import act.util.Stateless;
import act.util.SubClassFinder;

        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuditorService(Class<Auditor> auditorClass) {
        if (DumbAuditor.class.equals(auditorClass) || DefaultAuditor.class.getName().equals(auditorClass.getName())) {
            return;
        }
        Auditor auditor = app.getInstance(auditorClass);
        plugin().buildService(app, auditor);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuthenticationService(Class<AuthenticationService> serviceType) {
        if (ActAAAService.class.isAssignableFrom(serviceType)) {
            return;
        }
        AuthenticationService service = app.getInstance(serviceType);
        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundAuthorizationService(Class<AuthorizationService> serviceType) {
        AuthorizationService service = app.getInstance(serviceType);
        plugin().buildService(app, service);
    }

    @SubClassFinder(callOn = SysEventId.PRE_START)
    public void foundDynamicPermissionCheckHelper(final Class<DynamicPermissionCheckHelperBase> target) {
        final DynamicPermissionCheckHelperBase helper = app.getInstance(target);
        app.eventBus().bind(AAAInitialized.class, new ActEventListenerBase() {