}
public void addToDomainLevelComposite(QName compositeQName) throws NodeException {
if (nodeStarted){
throw new NodeException("Can't add composite " + compositeQName.toString() + " when the node is running. Call stop() on the node first");
}
// if no composite name is specified add all deployable composites
// to the domain
if (compositeQName == null){
for (Composite composite : composites.values()) {
if (!nodeComposite.getIncludes().contains(composite)) {
nodeComposite.getIncludes().add(composite);
try {
// build and activate the model for this composite
activateComposite(composite);
// register the composite with the domain
scaDomain.registerDomainLevelComposite(nodeURI, composite.getName().toString());
} catch (Exception ex) {
throw new NodeException(ex);
}
}
}
} else {
Composite composite = composites.get(compositeQName);
if (composite == null) {
throw new NodeException("Composite " + compositeQName.toString() + " not found" );
}
// if the named composite is not already in the list then deploy it
if (!nodeComposite.getIncludes().contains(composite)) {
nodeComposite.getIncludes().add(composite);
try {
// build and activate the model for this composite
activateComposite(composite);
// register the composite with the domain
scaDomain.registerDomainLevelComposite(nodeURI, composite.getName().toString());
} catch (Exception ex) {
throw new NodeException(ex);
}
}
}
}