Search in sources :

Example 6 with DynamicConfiguration

use of org.glassfish.hk2.api.DynamicConfiguration in project Payara by payara.

the class HK2IntegrationExtension method afterDeploymentValidation.

/**
 * Called by CDI after it has been completely validated.  Will add the JIT resolver to HK2
 * with the BeanManager
 *
 * @param event This is just to mark the type of the event
 * @param manager The manager that will be used to get references
 */
@SuppressWarnings("unused")
private void afterDeploymentValidation(@Observes AfterDeploymentValidation event) {
    if (locator == null)
        return;
    DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    config.addActiveDescriptor(CDISecondChanceResolver.class);
    config.addActiveDescriptor(CDIContextBridge.class);
    config.commit();
}
Also used : DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration)

Example 7 with DynamicConfiguration

use of org.glassfish.hk2.api.DynamicConfiguration in project Payara by payara.

the class WebContainer method addAndGetWebConfigListener.

private WebConfigListener addAndGetWebConfigListener() {
    ServiceLocator locator = serviceLocator;
    DynamicConfiguration config = locator.getService(DynamicConfigurationService.class).createDynamicConfiguration();
    config.addActiveDescriptor(WebConfigListener.class);
    config.commit();
    return locator.getService(WebConfigListener.class);
}
Also used : ServiceLocator(org.glassfish.hk2.api.ServiceLocator) DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration)

Example 8 with DynamicConfiguration

use of org.glassfish.hk2.api.DynamicConfiguration in project Payara by payara.

the class ConfigListenerTest method registerAndCreateHttpListenerContainer.

private HttpListenerContainer registerAndCreateHttpListenerContainer(ServiceLocator locator) {
    HttpListenerContainer retVal = locator.getService(HttpListenerContainer.class);
    if (retVal != null)
        return retVal;
    DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class);
    Assert.assertNotNull(dcs);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    config.addActiveDescriptor(HttpListenerContainer.class);
    config.commit();
    return locator.getService(HttpListenerContainer.class);
}
Also used : DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration)

Example 9 with DynamicConfiguration

use of org.glassfish.hk2.api.DynamicConfiguration in project Payara by payara.

the class ConfigTest method before.

@BeforeClass
public static void before() {
    DynamicConfigurationService dcs = habitat.getService(DynamicConfigurationService.class);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    new ConfigModule(habitat).configure(config);
    config.commit();
}
Also used : DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration) BeforeClass(org.junit.BeforeClass)

Example 10 with DynamicConfiguration

use of org.glassfish.hk2.api.DynamicConfiguration in project Payara by payara.

the class ConfigDisposalTest method before.

@Before
public void before() {
    String testName = TEST_NAME + RANDOM.nextInt();
    habitat = ServiceLocatorFactory.getInstance().create(testName);
    DynamicConfigurationService dcs = habitat.getService(DynamicConfigurationService.class);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    new ConfigModule(habitat).configure(config);
    config.commit();
    parseDomainXml();
}
Also used : DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration) Before(org.junit.Before)

Aggregations

DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)140 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)91 Test (org.junit.Test)72 ServiceLocator (org.glassfish.hk2.api.ServiceLocator)55 ActiveDescriptor (org.glassfish.hk2.api.ActiveDescriptor)29 MultiException (org.glassfish.hk2.api.MultiException)18 Singleton (jakarta.inject.Singleton)14 List (java.util.List)12 Descriptor (org.glassfish.hk2.api.Descriptor)9 Filter (org.glassfish.hk2.api.Filter)9 DescriptorImpl (org.glassfish.hk2.utilities.DescriptorImpl)9 Type (java.lang.reflect.Type)8 LinkedList (java.util.LinkedList)8 Factory (org.glassfish.hk2.api.Factory)8 ServiceLocatorFactory (org.glassfish.hk2.api.ServiceLocatorFactory)8 WriteableBeanDatabase (org.glassfish.hk2.configuration.hub.api.WriteableBeanDatabase)8 AliasDescriptor (org.glassfish.hk2.utilities.AliasDescriptor)7 ArrayList (java.util.ArrayList)6 FactoryDescriptors (org.glassfish.hk2.api.FactoryDescriptors)6 BaseHK2JAXBBean (org.glassfish.hk2.xml.jaxb.internal.BaseHK2JAXBBean)5