• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中act.app.App的典型用法代码示例。如果您正苦于以下问题:Java App类的具体用法?Java App怎么用?Java App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



App类属于act.app包,在下文中一共展示了App类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initStorageService

import act.app.App; //导入依赖的package包/类
@Override
protected IStorageService initStorageService(String id, App app, Map<String, String> conf) {
    conf = calibrate(conf, "storage.fs.");
    FileSystemService ss = new FileSystemService(conf);
    ss.setKeyNameProvider(UploadFileStorageService.ACT_STORAGE_KEY_NAME_PROVIDER);
    String home = conf.get(CONF_HOME_DIR);
    String url = ss.getStaticWebEndpoint();
    if (null != url) {
        if (!url.endsWith("/")) {
            url = url + "/";
        }
        if (S.notBlank(url) && !url.startsWith("http") && !url.startsWith("//")) {
            App.instance().router().addMapping(H.Method.GET, url, new FileGetter(new File(home)), RouteSource.BUILD_IN);
        }
    }
    return ss;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:18,代码来源:FileSystemStoragePlugin.java


示例2: initializeAAAService

import act.app.App; //导入依赖的package包/类
private AAAService initializeAAAService(final App app, final ActAAAService appSvc) {
    AAAService svc = services.get(app);
    if (null != svc) {
        return svc;
    }
    svc = null == appSvc ? new AAAService(app) : new AAAService(app, appSvc);
    services.put(app, svc);
    EventBus eventBus = app.eventBus();
    eventBus.bind(AppEventId.STOP, new AppEventListenerBase<AppStop>("aaa-stop") {
        @Override
        public void on(AppStop event) {
            services.remove(app);
        }
    });
    return svc;
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:17,代码来源:AAAPlugin.java


示例3: setup

import act.app.App; //导入依赖的package包/类
protected void setup() throws Exception {
    mockApp = mock(App.class);
    Field f = App.class.getDeclaredField("INST");
    f.setAccessible(true);
    f.set(null, mockApp);
    mockJobManager = mock(AppJobManager.class);
    mockEventBus = mock(EventBus.class);
    when(mockApp.jobManager()).thenReturn(mockJobManager);
    when(mockApp.eventBus()).thenReturn(mockEventBus);
    mockAppConfig = mock(AppConfig.class);
    when(mockAppConfig.possibleControllerClass(argThat(new StartsWith("testapp.controller.")))).thenReturn(true);
    mockActionContext = mock(ActionContext.class);
    when(mockActionContext.app()).thenReturn(mockApp);
    when(mockActionContext.config()).thenReturn(mockAppConfig);
    mockRouter = mock(Router.class);
    when(mockApp.config()).thenReturn(mockAppConfig);
    when(mockApp.router()).thenReturn(mockRouter);
    when(mockApp.getInstance(any(Class.class))).thenAnswer(new Answer<Object>() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
            Object[] args = invocation.getArguments();
            return $.newInstance((Class)args[0]);
        }
    });
    mockReq = mock(H.Request.class);
    mockResp = mock(H.Response.class);
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:28,代码来源:AAATestBase.java


示例4: prepare

import act.app.App; //导入依赖的package包/类
@BeforeClass
public static void prepare() {
    try {
        Field f = Act.class.getDeclaredField("pluginManager");
        f.setAccessible(true);
        f.set(null, new GenericPluginManager());
    } catch (Exception e) {
        throw E.unexpected(e);
    }
    app = App.testInstance();
    config = app.config();
    RequestHandlerResolver controllerLookup = new MockRequestHandlerResolver();
    router = new Router(controllerLookup, app);
    InputStream is = TestBase.class.getResourceAsStream("/routes");
    String fc = IO.readContentAsString(is);
    builder = new RouteTableRouterBuilder(fc.split("[\r\n]+"));
    builder.build(router);
    Play.pluginCollection = new PluginCollection();
    URL url = TestBase.class.getResource("/routes");
    Play.applicationPath = new File(FastStr.of(url.getPath()).beforeLast('/').toString());
    Play.routes = VirtualFile.fromRelativePath("routes");
    play.mvc.Router.load("");
}
 
开发者ID:actframework,项目名称:actframework,代码行数:24,代码来源:RouterBenchmark.java


示例5: start

import act.app.App; //导入依赖的package包/类
@Override
public void start() {
    bootUp();
    for (int port : registry.keySet()) {
        NetworkHandler client = registry.get(port);
        if (!trySetUpClient(client, port, securePorts.contains(port))) {
            failed.put(port, client);
        } else {
            Act.LOGGER.info("network client hooked on port: %s", port);
        }
    }
    started = true;
    App app = Act.app();
    if (null != app) {
        app.registerHotReloadListener(new App.HotReloadListener() {
            @Override
            public void preHotReload() {
                simpleWebSocketConnector = null;
            }
        });
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:23,代码来源:NetworkBase.java


示例6: AutoConfigLoader

import act.app.App; //导入依赖的package包/类
AutoConfigLoader(App app, Class<?> autoConfigClass) {
    this.conf = app.config();
    this.autoConfigClass = autoConfigClass;
    this.ns = (autoConfigClass.getAnnotation(AutoConfig.class)).value();
    this.resolverManager = app.resolverManager();
    this.injector = app.injector();
    synchronized (AutoConfigLoader.class) {
        allowChangeFinalField();
        app.jobManager().on(SysEventId.START, new Runnable() {
            @Override
            public void run() {
                resetFinalFieldUpdate();
            }
        });
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:17,代码来源:AutoConfigPlugin.java


示例7: HeaderValueLoader

import act.app.App; //导入依赖的package包/类
public HeaderValueLoader(String name, BeanSpec beanSpec) {
    this.key = key(name, beanSpec);
    this.targetType = beanSpec.rawType();
    this.isArray = targetType.isArray();
    this.multiValues = (isArray || Collection.class.isAssignableFrom(targetType));
    if (this.isArray) {
        this.elementType = this.targetType.getComponentType();
    } else if (this.multiValues) {
        this.elementType = (Class)(beanSpec.typeParams().get(0));
    } else {
        this.elementType = null;
    }
    Class effectiveType = null != elementType ? elementType : targetType;
    this.stringValueResolver = App.instance().resolverManager().resolver(effectiveType, beanSpec);
    E.illegalArgumentIf(null == this.stringValueResolver, "Cannot find out StringValueResolver for %s", beanSpec);
    this.defVal = StringValueResolverValueLoaderBase.defVal(null, effectiveType);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:18,代码来源:HeaderValueLoader.java


示例8: get

import act.app.App; //导入依赖的package包/类
@Override
public _SequenceNumberGenerator get() {
    if (generators.size() > 1) {
        App app = Act.app();
        AppConfig config = app.config();
        DbServiceManager dbServiceManager = app.dbServiceManager();
        for (_SequenceNumberGenerator gen: generators) {
            if (!_SequenceNumberGenerator.InMemorySequenceNumberGenerator.class.isInstance(gen)) {
                try {
                    gen.configure(config, dbServiceManager);
                } catch (Exception e) {
                    continue;
                }
                return gen;
            }
        }
    }
    return generators.get(0);
}
 
开发者ID:actframework,项目名称:actframework,代码行数:20,代码来源:SequenceNumberGenerator.java


示例9: tryGetSingleton

import act.app.App; //导入依赖的package包/类
/**
 * If the `invokerClass` specified is singleton, or without field or all fields are
 * stateless, then return an instance of the invoker class. Otherwise, return null
 * @param invokerClass the invoker class
 * @param app the app
 * @return an instance of the invokerClass or `null` if invoker class is stateful class
 */
public static Object tryGetSingleton(Class<?> invokerClass, App app) {
    Object singleton = app.singleton(invokerClass);
    if (null == singleton) {
        // check if there are fields
        List<Field> fields = $.fieldsOf(invokerClass);
        if (fields.isEmpty()) {
            singleton = app.getInstance(invokerClass);
        }
        boolean stateful = false;
        for (Field field : fields) {
            if (!isGlobalOrStateless(field)) {
                stateful = true;
                break;
            }
        }
        if (!stateful) {
            singleton = app.getInstance(invokerClass);
        }
    }
    return singleton;
}
 
开发者ID:actframework,项目名称:actframework,代码行数:29,代码来源:ReflectedInvokerHelper.java


示例10: EventBus

import act.app.App; //导入依赖的package包/类
private EventBus(App app, boolean once) {
    super(app, true);
    sysEventLookup = initSysEventLookup(app);

    sysEventListeners = initAppListenerArray();
    asyncSysEventListeners = initAppListenerArray();

    actEventListeners = new ConcurrentHashMap<>();
    asyncActEventListeners = new ConcurrentHashMap<>();

    adhocEventListeners = new ConcurrentHashMap<>();
    asyncAdhocEventListeners = new ConcurrentHashMap<>();

    loadDefaultEventListeners();
    if (!once) {
        onceBus = new EventBus(app, true);
        onceBus.once = true;
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:20,代码来源:EventBus.java


示例11: invoke

import act.app.App; //导入依赖的package包/类
@Override
public void invoke(Object... args) {
    int paramNo = paramTypes.size();
    int argsNo = args.length;
    Object[] realArgs = args;
    if (paramNo != argsNo || providedParamSize > 0) {
        realArgs = new Object[paramNo + providedParamSize];
        System.arraycopy(args, 0, realArgs, 0, Math.min(paramNo, argsNo));
        App app = Act.app();
        for (int i = 0; i < providedParamSize; ++i) {
            realArgs[i + paramNo] = app.getInstance(providedParamTypes.get(i));
        }
    }
    Object host = host();
    if (null == host) {
        $.invokeStatic(method, realArgs);
    } else {
        $.invokeVirtual(host, method, realArgs);
    }
}
 
开发者ID:actframework,项目名称:actframework,代码行数:21,代码来源:ReflectedSimpleEventListener.java


示例12: hookLifecycleInterceptors

import act.app.App; //导入依赖的package包/类
@Override
public void hookLifecycleInterceptors() {
    App.instance().eventBus().bind(PreEbeanCreation.class, new ActEventListenerBase<PreEbeanCreation>("storage:hook-ebean-lifecycle-interceptor") {
        @Override
        public void on(PreEbeanCreation event) throws Exception {
            ServerConfig config = event.source();
            BeanPostLoad postLoad = new StorageFieldConverter(ssm());
            config.add(postLoad);
            BeanPersistController persistController = (BeanPersistController) postLoad;
            config.add(persistController);
        }
    });
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:14,代码来源:EbeanDbHooker.java


示例13: ssm

import act.app.App; //导入依赖的package包/类
private StorageServiceManager ssm() {
    if (null == ssm) {
        synchronized (this) {
            if (null == ssm) {
                ssm = App.instance().singleton(StorageServiceManager.class);
            }
        }
    }
    return ssm;
}
 
开发者ID:actframework,项目名称:act-storage,代码行数:11,代码来源:EntityClassEnhancer.java


示例14: onInjection

import act.app.App; //导入依赖的package包/类
@Override
public void onInjection(Object injectee, BeanSpec spec) {
    final EbeanDao dao = $.cast(injectee);
    if (dao.ebeanServerProvided()) {
        return;
    }
    List<Type> typeParameters = spec.typeParams();
    if (typeParameters.isEmpty()) {
        typeParameters = Generics.typeParamImplementations(spec.rawType(), EbeanDao.class);
    }
    if (null == typeParameters) {
        logger.warn("No type parameter information provided");
        return;
    }
    final $.T2<Class, String> resolved = resolve(typeParameters);
    DbService dbService = App.instance().dbServiceManager().dbService(resolved._2);
    if (dbService instanceof EbeanService) {
        final EbeanService service = $.cast(dbService);
        Act.eventBus().bind(AppEventId.DB_SVC_LOADED, new AppEventListenerBase() {
            @Override
            public void on(EventObject eventObject) throws Exception {
                dao.ebean(service.ebean());
                dao.modelType(resolved._1);
            }
        });
    }
}
 
开发者ID:actframework,项目名称:act-ebean,代码行数:28,代码来源:EbeanDaoInjectionListener.java


示例15: generateTestData

import act.app.App; //导入依赖的package包/类
private void generateTestData(App app) {
    testData = new ArrayList<Employee>();
    Employee.Grade[] grades = Employee.Grade.values();
    for (String name : names) {
        testData.add(generateEmployee(app.cuid(), name, $.random(grades)));
    }
}
 
开发者ID:actframework,项目名称:act-demo-apps,代码行数:8,代码来源:TestDataGenerator.java


示例16: AAAService

import act.app.App; //导入依赖的package包/类
AAAService(final App app) {
    super(app);
    loadAuthenticateList();
    sessionKeyUsername = app.config().sessionKeyUsername();
    authorizationService = new SimpleAuthorizationService();
    auditor = DumbAuditor.INSTANCE;
    allowBasicAuthentication = app.config().basicAuthenticationEnabled();
    postOperations(app);
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:10,代码来源:AAAService.java


示例17: buildService

import act.app.App; //导入依赖的package包/类
public void buildService(App app, ActAAAService service) {
    AAAService aaa = initializeAAAService(app, service);
    // we need to check if persistent service is already
    // provisioned with buildService(App, AAAPersistentService) call
    if (null == aaa.persistentService()) {
        aaa.persistentService(new DefaultPersistentService(service));
        aaa.persistentService();
    }
    // we need to check if authentication service is already
    // provisioned with buildService(App, AuthenticationService) call
    if (null == aaa.authenticationService()) {
        aaa.authenticationService(service);
    }
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:15,代码来源:AAAPlugin.java


示例18: applyTo

import act.app.App; //导入依赖的package包/类
@Override
protected void applyTo(App app) {
    loadPluginAutoConfig(AAAConfig.class, app);
    loadPluginAutoConfig(AAAService.class, app);
    ensureDDL();
    ensureLoginUrl(app);
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:8,代码来源:AAAConfig.java


示例19: ensureLoginUrl

import act.app.App; //导入依赖的package包/类
private void ensureLoginUrl(final App app) {
    app.jobManager().beforeAppStart(new Runnable() {
        @Override
        public void run() {
            if (S.notBlank(loginUrl)) {
                return;
            }
            loginUrl = app.config().loginUrl();
        }
    });
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:12,代码来源:AAAConfig.java


示例20: initialized

import act.app.App; //导入依赖的package包/类
@Override
protected void initialized() {
    App app = App.instance();

    Class rawType = spec.rawType();
    dao = app.dbServiceManager().dao(rawType);

    querySpec = S.string(options.get(KEY_USER_KEY));
    if (S.blank(querySpec)) {
        querySpec = AAAConfig.user.key.get();
    }
}
 
开发者ID:actframework,项目名称:act-aaa-plugin,代码行数:13,代码来源:LoginUserFinder.java



注:本文中的act.app.App类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpRequest类代码示例发布时间:2022-05-22
下一篇:
Java ChunkCoordinates类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap