}
public SCAConfig read(XMLStreamReader reader, ProcessorContext context) throws XMLStreamException,
ContributionReadException {
int event = reader.getEventType();
SCAConfig definitions = factory.createSCAConfig();
String targetNamespace = null;
while (true) {
switch (event) {
case XMLStreamConstants.START_ELEMENT:
QName name = reader.getName();
if (SCA_CONFIG_QNAME.equals(name)) {
targetNamespace = reader.getAttributeValue(null, "targetNamespace");
definitions.setTargetNamespace(targetNamespace);
} else {
Object extension = processor.read(reader, context);
if (extension != null) {
if (extension instanceof Intent) {
Intent intent = (Intent)extension;
intent.setName(new QName(targetNamespace, intent.getName().getLocalPart()));
definitions.getIntents().add(intent);
for (Intent i : intent.getQualifiedIntents()) {
i.setName(new QName(targetNamespace, i.getName().getLocalPart()));
}
} else if (extension instanceof PolicySet) {
PolicySet policySet = (PolicySet)extension;
policySet.setName(new QName(targetNamespace, policySet.getName().getLocalPart()));
definitions.getPolicySets().add(policySet);
} else if (extension instanceof Binding) {
Binding binding = (Binding)extension;
definitions.getBindings().add(binding);
}
}
}
break;
case XMLStreamConstants.END_ELEMENT: