binding.setURI("http://localhost:" + (8100 + nodeID));
nodeService.getBindings().add(binding);
node.getServices().add(nodeService);
// Assign a deployable to the node
NodeImplementation nodeImplementation = nodeFactory.createNodeImplementation();
nodeImplementation.setComposite(deployable);
node.setImplementation(nodeImplementation);
// Keep track of what contributions will be needed by the node
nodeDependencies.put(node, contributionDependencies.get(contribution));
nodeID++;
}
}
// Print the model describing the nodes that we just built
System.out.println("cloud.composite");
System.out.println(print(cloudComposite));
// Build the nodes, this will apply their default binding configuration to the
// composites assigned to them
nodeCompositeBuilder.build(cloudComposite);
// Create a composite model for the domain
Composite domainComposite = assemblyFactory.createComposite();
domainComposite.setName(new QName("http://sample", "domain"));
// Add all deployables to it, normally the domain administrator would select
// the deployables to include
domainComposite.getIncludes().addAll(workspace.getDeployables());
// Build the domain composite and wire the components included in it
domainCompositeBuilder.build(domainComposite);
// Print out the resulting domain composite
System.out.println("domain.composite");
System.out.println(print(domainComposite));
// Now start our SCA nodes
List<SCANode2> runtimeNodes = new ArrayList<SCANode2>();
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;
}