System.out.println("domain.composite");
System.out.println(print(domainComposite));
// Now start our SCA nodes
List<SCANode> runtimeNodes = new ArrayList<SCANode>();
NodeLauncher launcher = NodeLauncher.newInstance();
for (Component node: cloudComposite.getComponents()) {
// Create a composite containing the components that we want to run
// on the node
Composite runnable = assemblyFactory.createComposite();
runnable.setName(new QName("http://sample", node.getName()));
NodeImplementation nodeImplementation = (NodeImplementation)node.getImplementation();
for (Component component: nodeImplementation.getComposite().getComponents()) {
for (Component configured: domainComposite.getComponents()) {
if (configured.getName().equals(component.getName())) {
runnable.getComponents().add(configured);
break;
}
}
}
// Create the SCA node, give it the composite and the list of contributions
// to use
List<Contribution> dependencies = nodeDependencies.get(node);
org.apache.tuscany.sca.node.launcher.Contribution[] contributions = new org.apache.tuscany.sca.node.launcher.Contribution[dependencies.size()];
for (int c =0, n = dependencies.size(); c < n; c++) {
Contribution dependency = dependencies.get(c);
contributions[c] = new org.apache.tuscany.sca.node.launcher.Contribution(dependency.getURI(), dependency.getLocation());
}
SCANode runtimeNode = launcher.createNode("http://sample/" + node.getName(), print(runnable), contributions);
// Start the node
runtimeNode.start();
runtimeNodes.add(runtimeNode);
}