/** * Returns the SCA node factory instance. * * @return the SCA node factory */ public synchronized static NodeFactory getInstance() { if (instance == null) { instance = newInstance(); } return instance; }
/** * Returns the SCA node factory instance. * * @return the SCA node factory */ public synchronized static NodeFactory getInstance() { if (instance == null) { instance = newInstance(); } return instance; }
public static NodeFactory newInstance(String configURI) { Properties properties; if (configURI == null || configURI.length() < 1) { return newInstance(); } else if (configURI.startsWith("properties:")) { try { properties = loadProperties(configURI.substring("properties:".length())); } catch (IOException e) { throw new ServiceRuntimeException(e); } } else if (configURI.startsWith("uri:")) { properties = parseConfigURI(configURI.substring("uri:".length())); } else { properties = new Properties(); properties.setProperty("defaultDomainName", configURI); } return newInstance(properties); }
public static NodeFactory newInstance(String configURI) { Properties properties; if (configURI == null || configURI.length() < 1) { return newInstance(); } else if (configURI.startsWith("properties:")) { try { properties = loadProperties(configURI.substring("properties:".length())); } catch (IOException e) { throw new ServiceRuntimeException(e); } } else if (configURI.startsWith("uri:")) { properties = parseConfigURI(configURI.substring("uri:".length())); } else { properties = new Properties(); properties.setProperty("defaultDomainName", configURI); } return newInstance(properties); }
/** * Start an SCA node * @param args a list of contribution jars for the node to run */ public static void main(String[] args) throws Exception { Contribution[] contributions = new Contribution[args.length]; for (int i = 0; i < args.length; i++) { File f = new File(args[i]); if (!f.exists()) { System.err.println("contribution not found: " + f); System.exit(1); } contributions[i] = new Contribution(f.toURI().toString(), f.toURI().toString()); } Node node = NodeFactory.newInstance().createNode(contributions).start(); System.out.println("Hit enter to stop node..."); if (System.in.read() == -1) { // no sysin so wait for ever letting caller do the terminate Object lock = new Object(); synchronized (lock) { lock.wait(); } } node.stop(); } }
/** * Start an SCA node * @param args a list of contribution jars for the node to run */ public static void main(String[] args) throws Exception { Contribution[] contributions = new Contribution[args.length]; for (int i = 0; i < args.length; i++) { File f = new File(args[i]); if (!f.exists()) { System.err.println("contribution not found: " + f); System.exit(1); } contributions[i] = new Contribution(f.toURI().toString(), f.toURI().toString()); } Node node = NodeFactory.newInstance().createNode(contributions).start(); System.out.println("Hit enter to stop node..."); if (System.in.read() == -1) { // no sysin so wait for ever letting caller do the terminate Object lock = new Object(); synchronized (lock) { lock.wait(); } } node.stop(); } }
/** * 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); } } }