Search in sources :

Example 1 with EmbeddedInhabitantsParser

use of com.sun.enterprise.glassfish.bootstrap.EmbeddedInhabitantsParser in project Payara by payara.

the class MicroGlassFishRuntime method newGlassFish.

@Override
public GlassFish newGlassFish(GlassFishProperties glassfishProperties) throws GlassFishException {
    System.setProperty("com.sun.aas.installRoot", System.getProperty("com.sun.aas.instanceRoot"));
    System.setProperty("com.sun.aas.installRootURI", System.getProperty("com.sun.aas.instanceRootURI"));
    glassfishProperties.setProperty("com.sun.aas.installRoot", System.getProperty("com.sun.aas.instanceRoot"));
    glassfishProperties.setProperty("com.sun.aas.installRootURI", System.getProperty("com.sun.aas.instanceRootURI"));
    StartupContext context = new StartupContext(glassfishProperties.getProperties());
    ClassLoader tccl = Thread.currentThread().getContextClassLoader();
    SingleHK2Factory.initialize(tccl);
    registry = new SingleModulesRegistry(tccl);
    registry.setParentClassLoader(tccl);
    habitat = registry.newServiceLocator();
    DynamicConfigurationService dcs = habitat.getService(DynamicConfigurationService.class);
    DynamicConfiguration config = dcs.createDynamicConfiguration();
    config.addActiveDescriptor(BuilderHelper.createConstantDescriptor(context));
    config.commit();
    registry.populateServiceLocator("default", habitat, Arrays.asList(new PayaraMicroInhabitantsParser(), new EmbeddedInhabitantsParser(), new DuplicatePostProcessor()));
    registry.populateConfig(habitat);
    ModuleStartup kernel = habitat.getService(ModuleStartup.class);
    gf = new MicroGlassFish(kernel, habitat, glassfishProperties.getProperties());
    return gf;
}
Also used : StartupContext(com.sun.enterprise.module.bootstrap.StartupContext) DynamicConfigurationService(org.glassfish.hk2.api.DynamicConfigurationService) SingleModulesRegistry(com.sun.enterprise.module.single.SingleModulesRegistry) DynamicConfiguration(org.glassfish.hk2.api.DynamicConfiguration) DuplicatePostProcessor(org.glassfish.hk2.utilities.DuplicatePostProcessor) EmbeddedInhabitantsParser(com.sun.enterprise.glassfish.bootstrap.EmbeddedInhabitantsParser) ModuleStartup(com.sun.enterprise.module.bootstrap.ModuleStartup)

Aggregations

EmbeddedInhabitantsParser (com.sun.enterprise.glassfish.bootstrap.EmbeddedInhabitantsParser)1 ModuleStartup (com.sun.enterprise.module.bootstrap.ModuleStartup)1 StartupContext (com.sun.enterprise.module.bootstrap.StartupContext)1 SingleModulesRegistry (com.sun.enterprise.module.single.SingleModulesRegistry)1 DynamicConfiguration (org.glassfish.hk2.api.DynamicConfiguration)1 DynamicConfigurationService (org.glassfish.hk2.api.DynamicConfigurationService)1 DuplicatePostProcessor (org.glassfish.hk2.utilities.DuplicatePostProcessor)1