public Class<ContributionMetadata> getModelType() {
return ContributionMetadata.class;
}
public ContributionMetadata read(XMLStreamReader reader) throws ContributionReadException {
ContributionMetadata contribution = null;
QName name = null;
try {
while (reader.hasNext()) {
int event = reader.getEventType();
switch (event) {
case START_ELEMENT:
name = reader.getName();
if (CONTRIBUTION_QNAME.equals(name)) {
// Read <contribution>
contribution = this.contributionFactory.createContributionMetadata();
contribution.setUnresolved(true);
} else if (DEPLOYABLE_QNAME.equals(name)) {
// Read <deployable>
QName compositeName = getQName(reader, "composite");
if (compositeName == null) {
error("AttributeCompositeMissing", reader);
//throw new ContributionReadException("Attribute 'composite' is missing");
} else {
if (contribution != null) {
Composite composite = assemblyFactory.createComposite();
composite.setName(compositeName);
composite.setUnresolved(true);
contribution.getDeployables().add(composite);
}
}
} else {
// Read an extension element
Object extension = extensionProcessor.read(reader);
if (extension != null && contribution != null) {
if (extension instanceof Import) {
contribution.getImports().add((Import)extension);
} else if (extension instanceof Export) {
contribution.getExports().add((Export)extension);
}
}
}
break;