// for each module implementing the @Contract DomainInitializer, extract
// the initial domain.xml and insert it into the existing domain.xml
BootstrapProperties bootstrapProperties = new BootstrapProperties();
bootstrapProperties.setInstallRoot(domainConfig.getInstallRoot());
GlassFishRuntime runtime = GlassFishRuntime.bootstrap(bootstrapProperties);
File domDir = new File(domainConfig.getDomainRoot(),
domainConfig.getDomainName());
File configDir = new File(domDir, "config");
GlassFishProperties glassFishProperties = new GlassFishProperties();
glassFishProperties.setConfigFileURI(new File(configDir,
"domain.xml").toURI().toString());
glassFishProperties.setConfigFileReadOnly(false);
glassFishProperties.setProperty(StartupContext.STARTUP_MODULESTARTUP_NAME,
"DomainCreation");
glassFishProperties.setProperty(SystemPropertyConstants.INSTANCE_ROOT_PROPERTY,
domDir.getAbsolutePath());
glassFishProperties.setProperty("-domain", domainConfig.getDomainName());
GlassFish glassfish = runtime.newGlassFish(glassFishProperties);
glassfish.start();
// Will always need DAS's name & config. No harm using the name 'server'
// to fetch <server-config>
com.sun.enterprise.config.serverbeans.Server serverConfig =