}
public Runtime read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
QName name = null;
Runtime runtime = null;
Node node = null;
String domainName = DEFAULT_DOMAIN;
// Read the composite document
while (reader.hasNext()) {
int event = reader.getEventType();
switch (event) {
case START_ELEMENT:
name = reader.getName();
if (RUNTIME_QNAME.equals(name)) {
// Read a <runtime>
runtime = topologyFactory.createRuntime();
} else if (NODE_QNAME.equals(name)) {
// Read a <node>
node = topologyFactory.createNode();
node.setName(getString(reader, NAME));
// add node to runtime
runtime.getNodes().add(node);
// reset domain name to the default
domainName = DEFAULT_DOMAIN;
} else if (DOMAIN_QNAME.equals(name)) {
// Read a <domain>
domainName = getString(reader, NAME);
} else if (SCHEME_QNAME.equals(name)) {
// Read a <scheme>
Scheme scheme = topologyFactory.createScheme();
scheme.setName(getString(reader, NAME));
scheme.setBaseURL(getString(reader, BASE_URL));
scheme.setDomainName(domainName);
// Add scheme to the node
node.getSchemes(domainName).add(scheme);
} else if (COMPONENT_QNAME.equals(name)) {
// Read a <component>
Component component = topologyFactory.createComponent();
component.setName(getString(reader, NAME));
component.setDomainName(domainName);
// Add scheme to the node
node.getComponents(domainName).add(component);
} else {
// Read an extension element
Object extension = extensionProcessor.read(reader);