Search in sources :

Example 1 with App

use of act.app.App in project actframework by actframework.

the class ControllerClassMetaInfo method getAllWithList.

private void getAllWithList(final Set<String> withList, final ControllerClassMetaInfoManager infoBase) {
    withList.addAll(this.withList);
    if (null != superType) {
        final String superClass = superType.getClassName();
        App app = App.instance();
        ClassInfoRepository repo = app.classLoader().classInfoRepository();
        ControllerClassMetaInfo info = infoBase.controllerMetaInfo(superClass);
        String curSuperClass = superClass;
        while (null == info && !"java.lang.Object".equals(curSuperClass)) {
            ClassNode node = repo.node(curSuperClass);
            if (null != node) {
                node = node.parent();
            }
            if (null == node) {
                break;
            }
            curSuperClass = node.name();
            info = infoBase.controllerMetaInfo(curSuperClass);
        }
        if (null != info) {
            withList.add(superClass);
        }
    }
}
Also used : App(act.app.App) ClassNode(act.util.ClassNode) ClassInfoRepository(act.util.ClassInfoRepository)

Example 2 with App

use of act.app.App in project actframework by actframework.

the class ClassFinderData method scheduleFind.

public void scheduleFind() {
    if (logger.isTraceEnabled()) {
        logger.trace("schedule class finding for %s", this);
    }
    final App app = App.instance();
    app.jobManager().on(when, jobId(), new Runnable() {

        @Override
        public void run() {
            how.find(app, ClassFinderData.this);
        }
    });
}
Also used : App(act.app.App)

Example 3 with App

use of act.app.App in project actframework by actframework.

the class AppConfigPlugin method foundConfigurator.

@SubClassFinder(callOn = SysEventId.CLASS_LOADED)
public static void foundConfigurator(final Class<? extends AppConfigurator> configuratorClass) {
    final App app = App.instance();
    AppConfigurator configurator = app.getInstance(configuratorClass);
    configurator.app(app);
    configurator.configure();
    app.config()._merge(configurator);
}
Also used : App(act.app.App) SubClassFinder(act.util.SubClassFinder)

Example 4 with App

use of act.app.App in project actframework by actframework.

the class RequestHandlerProxy method registerGlobalInterceptors.

@AnnotatedClassFinder(value = Global.class, callOn = SysEventId.PRE_START)
@SuppressWarnings("unused")
public static void registerGlobalInterceptors(Class<?> interceptorClass) {
    App app = Act.app();
    if (BeforeInterceptor.class.isAssignableFrom(interceptorClass)) {
        BeforeInterceptor interceptor = (BeforeInterceptor) app.getInstance(interceptorClass);
        registerGlobalInterceptor(interceptor);
    } else if (AfterInterceptor.class.isAssignableFrom(interceptorClass)) {
        AfterInterceptor interceptor = (AfterInterceptor) app.getInstance(interceptorClass);
        registerGlobalInterceptor(interceptor);
    } else if (ExceptionInterceptor.class.isAssignableFrom(interceptorClass)) {
        ExceptionInterceptor interceptor = (ExceptionInterceptor) app.getInstance(interceptorClass);
        registerGlobalInterceptor(interceptor);
    } else if (FinallyInterceptor.class.isAssignableFrom(interceptorClass)) {
        FinallyInterceptor interceptor = (FinallyInterceptor) app.getInstance(interceptorClass);
        registerGlobalInterceptor(interceptor);
    } else {
        // check if this is a free style interceptor
        ControllerClassMetaInfo metaInfo = app.classLoader().controllerClassMetaInfo(interceptorClass.getName());
        if (null != metaInfo) {
            registerGlobalInterceptor(metaInfo.interceptors());
        }
    }
}
Also used : App(act.app.App) AnnotatedClassFinder(act.util.AnnotatedClassFinder)

Example 5 with App

use of act.app.App in project actframework by actframework.

the class DependencyInjectorBase method discoverDiListener.

@SubClassFinder(value = DependencyInjectionListener.class, callOn = SysEventId.DEPENDENCY_INJECTOR_PROVISIONED)
public static void discoverDiListener(final Class<? extends DependencyInjectionListener> target) {
    App app = App.instance();
    DependencyInjector di = app.injector();
    di.registerDiListener(app.getInstance(target));
}
Also used : App(act.app.App) SubClassFinder(act.util.SubClassFinder)

Aggregations

App (act.app.App)19 AppConfig (act.conf.AppConfig)2 SubClassFinder (act.util.SubClassFinder)2 Type (java.lang.reflect.Type)2 Act (act.Act)1 SysEventListenerBase (act.event.SysEventListenerBase)1 DependencyInjector (act.inject.DependencyInjector)1 DuplicateRouteMappingException (act.route.DuplicateRouteMappingException)1 AnnotatedClassFinder (act.util.AnnotatedClassFinder)1 ClassInfoRepository (act.util.ClassInfoRepository)1 ClassNode (act.util.ClassNode)1 Template (act.view.Template)1 File (java.io.File)1 Field (java.lang.reflect.Field)1 Method (java.lang.reflect.Method)1 ParameterizedType (java.lang.reflect.ParameterizedType)1 ArrayList (java.util.ArrayList)1 NotNull (javax.validation.constraints.NotNull)1 BeforeClass (org.junit.BeforeClass)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1