this.definitionsResolver = modelResolver;
}
public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
QName name = null;
SCADefinitions definitions = null;
// Read the composite document
while (reader.hasNext()) {
int event = reader.getEventType();
switch (event) {
case START_ELEMENT: {
name = reader.getName();
if ( SCA_DEFINITIONS_QNAME.equals(name)) {
definitions = new SCADefinitionsImpl();
definitions.setTargetNamespace(reader.getAttributeValue(null, TARGET_NAMESPACE));
} else {
Object extension = extensionProcessor.read(reader);
if (extension != null) {
if ( extension instanceof Intent ) {
definitions.getPolicyIntents().add((Intent)extension);
} else if ( extension instanceof PolicySet ) {
definitions.getPolicySets().add((PolicySet)extension);
} else if ( extension instanceof IntentAttachPointType ) {
IntentAttachPointType type = (IntentAttachPointType)extension;
if ( type.getName().getLocalPart().startsWith(BINDING)) {
definitions.getBindingTypes().add((IntentAttachPointType)extension);
} else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
definitions.getImplementationTypes().add((IntentAttachPointType)extension);
}
}
if ( getDefinitionsResolver() != null ) {
getDefinitionsResolver().addModel(extension);