Search in sources :

Example 1 with RunLevel

use of org.glassfish.hk2.runlevel.RunLevel in project Payara by payara.

the class BasicModularityTest method ensureRunLevel.

// TODO add more tests to cover token processing and i18n support
private void ensureRunLevel(int runlevel) {
    RunLevelController controller = habitat.getService(RunLevelController.class);
    controller.proceedTo(runlevel);
}
Also used : RunLevelController(org.glassfish.hk2.runlevel.RunLevelController)

Example 2 with RunLevel

use of org.glassfish.hk2.runlevel.RunLevel in project Payara by payara.

the class AppServerStartupTest method bindService.

private void bindService(DynamicConfiguration configurator, Class<?> service) {
    final DescriptorBuilder descriptorBuilder = BuilderHelper.link(service);
    final RunLevel rla = service.getAnnotation(RunLevel.class);
    if (rla != null) {
        descriptorBuilder.to(RunLevel.class).has(RunLevel.RUNLEVEL_VAL_META_TAG, Collections.singletonList(((Integer) rla.value()).toString())).has(RunLevel.RUNLEVEL_MODE_META_TAG, Collections.singletonList(((Integer) rla.mode()).toString()));
        descriptorBuilder.in(RunLevel.class);
    }
    Class clazz = service;
    while (clazz != null) {
        Class<?>[] interfaces = clazz.getInterfaces();
        for (int j = 0; j < interfaces.length; j++) {
            descriptorBuilder.to(interfaces[j]);
        }
        clazz = clazz.getSuperclass();
    }
    final Named named = service.getAnnotation(Named.class);
    if (named != null) {
        descriptorBuilder.named(named.value());
    }
    configurator.bind(descriptorBuilder.build());
}
Also used : Named(javax.inject.Named) PostStartupRunLevel(org.glassfish.internal.api.PostStartupRunLevel) RunLevel(org.glassfish.hk2.runlevel.RunLevel) InitRunLevel(org.glassfish.internal.api.InitRunLevel) StartupRunLevel(org.glassfish.api.StartupRunLevel) DescriptorBuilder(org.glassfish.hk2.utilities.DescriptorBuilder)

Aggregations

Named (javax.inject.Named)1 StartupRunLevel (org.glassfish.api.StartupRunLevel)1 RunLevel (org.glassfish.hk2.runlevel.RunLevel)1 RunLevelController (org.glassfish.hk2.runlevel.RunLevelController)1 DescriptorBuilder (org.glassfish.hk2.utilities.DescriptorBuilder)1 InitRunLevel (org.glassfish.internal.api.InitRunLevel)1 PostStartupRunLevel (org.glassfish.internal.api.PostStartupRunLevel)1