/** * Bootstrap the Tuscany runtime for the given scope * @param configurator */ private synchronized static void bootstrapRuntime(final WebContextConfigurator configurator) { if (host == null) { try { String configValue = configurator.getInitParameter("org.apache.tuscany.sca.config"); if (configValue != null) { factory = NodeFactory.newInstance(configValue); } else { factory = NodeFactory.newInstance(); } // Add ServletContext as a utility ExtensionPointRegistry registry = factory.getExtensionPointRegistry(); UtilityExtensionPoint utilityExtensionPoint = registry.getExtensionPoint(UtilityExtensionPoint.class); utilityExtensionPoint.addUtility(ServletContext.class, configurator.getServletContext()); ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class); servletHosts.setWebApp(true); host = getServletHost(configurator); } catch (ServletException e) { throw new ServiceRuntimeException(e); } } }