Search in sources :

Example 1 with EventsImpl

use of org.glassfish.kernel.event.EventsImpl in project Payara by payara.

the class AppServerStartupTest method initialize.

// ----- test initialization ---------------------------------------------
private void initialize(ServiceLocator testLocator) {
    DynamicConfigurationService dcs = testLocator.getService(DynamicConfigurationService.class);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(new TestSystemTasks()));
    // These are services that would normally be started by hk2 core
    config.addActiveDescriptor(AppServerStartup.AppInstanceListener.class);
    AbstractActiveDescriptor<?> descriptor = BuilderHelper.createConstantDescriptor(new TestModulesRegistry());
    descriptor.addContractType(ModulesRegistry.class);
    config.addActiveDescriptor(descriptor);
    descriptor = BuilderHelper.createConstantDescriptor(new ExecutorServiceFactory().provide());
    descriptor.addContractType(ExecutorService.class);
    config.addActiveDescriptor(descriptor);
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(new ServerEnvironmentImpl()));
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(new EventsImpl()));
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(new Version()));
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(new StartupContext()));
    config.bind(BuilderHelper.link(RunLevelControllerImpl.class).to(RunLevelController.class).build());
    config.addUnbindFilter(BuilderHelper.createContractFilter(RunLevelContext.class.getName()));
    config.bind(BuilderHelper.link(RunLevelContext.class).to(Context.class).in(Singleton.class).build());
    config.addUnbindFilter(BuilderHelper.createContractFilter(AsyncRunLevelContext.class.getName()));
    config.bind(BuilderHelper.link(AsyncRunLevelContext.class).in(Singleton.class).build());
    config.bind(BuilderHelper.link(AppServerStartup.class).build());
    descriptor = BuilderHelper.createConstantDescriptor(testLocator);
    descriptor.addContractType(ServiceLocator.class);
    config.addActiveDescriptor(descriptor);
    bindService(config, TestInitRunLevelService.class);
    bindService(config, TestStartupService.class);
    bindService(config, TestStartupRunLevelService.class);
    bindService(config, TestPostStartupRunLevelService.class);
    bindService(config, CommonClassLoaderServiceImpl.class);
    bindService(config, APIClassLoaderServiceImpl.class);
    bindService(config, APIExporterImpl.class);
    config.commit();
}
Also used : RunLevelContext(org.glassfish.hk2.runlevel.RunLevelContext) StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) AsyncRunLevelContext(org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext) Context(org.glassfish.hk2.api.Context) DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) ServerEnvironmentImpl(org.glassfish.server.ServerEnvironmentImpl) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration) Version(com.sun.appserv.server.util.Version) AsyncRunLevelContext(org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext) RunLevelControllerImpl(org.glassfish.hk2.runlevel.internal.RunLevelControllerImpl) EventsImpl(org.glassfish.kernel.event.EventsImpl)

Aggregations

Version (com.sun.appserv.server.util.Version)1 StartupContext (com.sun.enterprise.module.bootstrap.StartupContext)1 Context (org.glassfish.hk2.api.Context)1 DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)1 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)1 RunLevelContext (org.glassfish.hk2.runlevel.RunLevelContext)1 AsyncRunLevelContext (org.glassfish.hk2.runlevel.internal.AsyncRunLevelContext)1 RunLevelControllerImpl (org.glassfish.hk2.runlevel.internal.RunLevelControllerImpl)1 EventsImpl (org.glassfish.kernel.event.EventsImpl)1 ServerEnvironmentImpl (org.glassfish.server.ServerEnvironmentImpl)1