public void start() throws ServerStartException {
try {
// Determine the ServerEnvironment
ServerEnvironment serverEnvironment = Main.determineEnvironment(cmdargs, systemProps, systemEnv, ServerEnvironment.LaunchType.EMBEDDED);
Bootstrap bootstrap = Bootstrap.Factory.newInstance();
Bootstrap.Configuration configuration = new Bootstrap.Configuration(serverEnvironment);
/*
* This would setup an {@link TransientConfigurationPersister} which does not persist anything
*
final ExtensionRegistry extensionRegistry = configuration.getExtensionRegistry();
final Bootstrap.ConfigurationPersisterFactory configurationPersisterFactory = new Bootstrap.ConfigurationPersisterFactory() {
@Override
public ExtensibleConfigurationPersister createConfigurationPersister(ServerEnvironment serverEnvironment, ExecutorService executorService) {
final QName rootElement = new QName(Namespace.CURRENT.getUriString(), "server");
final StandaloneXml parser = new StandaloneXml(Module.getBootModuleLoader(), executorService, extensionRegistry);
final File configurationFile = serverEnvironment.getServerConfigurationFile().getBootFile();
XmlConfigurationPersister persister = new TransientConfigurationPersister(configurationFile, rootElement, parser, parser);
for (Namespace namespace : Namespace.domainValues()) {
if (!namespace.equals(Namespace.CURRENT)) {
persister.registerAdditionalRootElement(new QName(namespace.getUriString(), "server"), parser);
}
}
extensionRegistry.setWriterRegistry(persister);
return persister;
}
};
configuration.setConfigurationPersisterFactory(configurationPersisterFactory);
*/
configuration.setModuleLoader(moduleLoader);
Future<ServiceContainer> future = bootstrap.startup(configuration, Collections.<ServiceActivator>emptyList());
serviceContainer = future.get();
@SuppressWarnings("unchecked")
final Value<ModelController> controllerService = (Value<ModelController>) serviceContainer.getRequiredService(Services.JBOSS_SERVER_CONTROLLER);