public static NodeFactory newInstance(Map<String, Map<String, String>> attributes) { NodeFactory nodeFactory = null; try { Class<?> factoryClass = getFactoryImplClass(); nodeFactory = (NodeFactory)factoryClass.newInstance(); nodeFactory.configure(attributes); } catch (Exception e) { throw new ServiceRuntimeException(e); } factories.add(nodeFactory); return nodeFactory; }
/** * Create a new SCA node using the list of SCA contributions * @param contributions * @return */ public Node createNode(Contribution... contributions) { NodeConfiguration configuration = createConfiguration(contributions); return createNode(configuration); }
public static void destroy() { if (factory != null) { factory.destroy(); } factory = null; host = null; }
/** * Creates a new SCA node from the XML configuration of the node * @param is The input stream that the XML configuration can be read. The stream will be closed * after this call. * @return a new SCA node */ public Node createNode(InputStream is) { NodeConfiguration configuration = loadConfiguration(is, null); return createNode(configuration); }
public final Node createNode(String deploymentCompositeURI, String locations[]) { return createNode(deploymentCompositeURI, getContributions(Arrays.asList(locations))); }
public final Node createNode(URI domainRegistryURI, String deploymentCompositeURI, String[] locations) { Contribution[] contributions = getContributions(Arrays.asList(locations)); NodeConfiguration configuration = createConfiguration(contributions); if (deploymentCompositeURI != null && configuration.getContributions().size() > 0) { configuration.getContributions().get(0).addDeploymentComposite(createURI(deploymentCompositeURI)); } configuration.setDomainRegistryURI(domainRegistryURI.toString()); configuration.setDomainURI(getDomainURI(domainRegistryURI)); return createNode(configuration); }
/** * Creates a new SCA node from the configuration URL * * @param configurationURL the URL of the node configuration which is the XML document * that contains the URI of the composite and a collection of URLs for the contributions * * @return a new SCA node. */ public Node createNode(URL configurationURL) { try { InputStream is = openStream(configurationURL); NodeConfiguration configuration = loadConfiguration(is, configurationURL); return createNode(configuration); } catch (IOException e) { throw new ServiceRuntimeException(e); } }
/** * 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(); } }
public final Node createNode(URI domainRegistryURI, String... locations) { return createNode(domainRegistryURI, null, locations); }
@Override public void configure(Map<String, Map<String, String>> attributes) { ServiceDiscovery discovery = getExtensionPointRegistry().getServiceDiscovery(); for (Map.Entry<String, Map<String, String>> e : attributes.entrySet()) { discovery.setAttribute(e.getKey(), e.getValue()); } for (Object o : properties.keySet()) { String p = (String) o; if (p.indexOf('.') > -1) { String serviceType = p.substring(0, p.lastIndexOf('.')); String attribute = p.substring(p.lastIndexOf('.')+1); discovery.setAttribute(serviceType, attribute, properties.getProperty(p)); } } quietLogging = Boolean.parseBoolean(properties.getProperty(RuntimeProperties.QUIET_LOGGING)); super.configure(attributes); }
if (nodeConfigURI != null) { URL url = getResource(servletContext, nodeConfigURI); configuration = factory.loadConfiguration(url.openStream(), url); } else { configuration = factory.createNodeConfiguration();
private NodeConfiguration createConfiguration(Contribution... contributions) { NodeConfigurationFactory factory = this; NodeConfiguration configuration = factory.createNodeConfiguration(); if (properties.getProperty("defaultDomainName") != null) { configuration.setDomainURI(properties.getProperty("defaultDomainName")); } // Make sure a unique node URI is created for the same node factory configuration.setURI(generateNodeURI()); if (contributions != null) { for (Contribution c : contributions) { configuration.addContribution(c.getURI(), c.getLocation()); } } return configuration; }
/** * Returns a new SCA node factory instance. * * @return a new SCA node factory */ public static NodeFactory newInstance() { NodeFactory nodeFactory = null; try { Class<?> factoryClass = getFactoryImplClass(); nodeFactory = (NodeFactory)factoryClass.newInstance(); } catch (Exception e) { throw new ServiceRuntimeException(e); } factories.add(nodeFactory); return nodeFactory; }
public final Node createNode(URI domainRegistryURI, String deploymentCompositeURI, String[] locations) { Contribution[] contributions = getContributions(Arrays.asList(locations)); NodeConfiguration configuration = createConfiguration(contributions); if (deploymentCompositeURI != null && configuration.getContributions().size() > 0) { configuration.getContributions().get(0).addDeploymentComposite(createURI(deploymentCompositeURI)); } configuration.setDomainRegistryURI(domainRegistryURI.toString()); configuration.setDomainURI(getDomainURI(domainRegistryURI)); return createNode(configuration); }
public final Node createNode(String deploymentCompositeURI, String locations[]) { return createNode(deploymentCompositeURI, getContributions(Arrays.asList(locations))); }
/** * Creates a new SCA node from the configuration URL * * @param configurationURL the URL of the node configuration which is the XML document * that contains the URI of the composite and a collection of URLs for the contributions * * @return a new SCA node. */ public Node createNode(URL configurationURL) { try { InputStream is = openStream(configurationURL); NodeConfiguration configuration = loadConfiguration(is, configurationURL); return createNode(configuration); } catch (IOException e) { throw new ServiceRuntimeException(e); } }
/** * Creates a new SCA node from the XML configuration of the node * @param is The input stream that the XML configuration can be read. The stream will be closed * after this call. * @return a new SCA node */ public Node createNode(InputStream is) { NodeConfiguration configuration = loadConfiguration(is, null); return createNode(configuration); }
/** * 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(); } }
public final Node createNode(URI domainRegistryURI, String... locations) { return createNode(domainRegistryURI, null, locations); }
@Override public void configure(Map<String, Map<String, String>> attributes) { ServiceDiscovery discovery = getExtensionPointRegistry().getServiceDiscovery(); for (Map.Entry<String, Map<String, String>> e : attributes.entrySet()) { discovery.setAttribute(e.getKey(), e.getValue()); } for (Object o : properties.keySet()) { String p = (String) o; if (p.indexOf('.') > -1) { String serviceType = p.substring(0, p.lastIndexOf('.')); String attribute = p.substring(p.lastIndexOf('.')+1); discovery.setAttribute(serviceType, attribute, properties.getProperty(p)); } } quietLogging = Boolean.parseBoolean(properties.getProperty(RuntimeProperties.QUIET_LOGGING)); super.configure(attributes); }