Monitor monitor) {
super(modelFactories, extensionProcessor, monitor);
}
public ComponentType read(XMLStreamReader reader) throws ContributionReadException {
ComponentType componentType = null;
Service service = null;
Reference reference = null;
Contract contract = null;
Property property = null;
Callback callback = null;
QName name = null;
try {
// Read the componentType document
while (reader.hasNext()) {
int event = reader.getEventType();
switch (event) {
case START_ELEMENT:
name = reader.getName();
if (Constants.COMPONENT_TYPE_QNAME.equals(name)) {
// Read a <componentType>
componentType = assemblyFactory.createComponentType();
componentType.setConstrainingType(readConstrainingType(reader));
} else if (Constants.SERVICE_QNAME.equals(name)) {
// Read a <service>
service = assemblyFactory.createService();
contract = service;
service.setName(getString(reader, Constants.NAME));
componentType.getServices().add(service);
policyProcessor.readPolicies(service, reader);
} else if (Constants.REFERENCE_QNAME.equals(name)) {
// Read a <reference>
reference = assemblyFactory.createReference();
contract = reference;
reference.setName(getString(reader, Constants.NAME));
reference.setWiredByImpl(getBoolean(reader, Constants.WIRED_BY_IMPL));
readMultiplicity(reference, reader);
readTargets(reference, reader);
componentType.getReferences().add(reference);
policyProcessor.readPolicies(reference, reader);
} else if (Constants.PROPERTY_QNAME.equals(name)) {
// Read a <property>
property = assemblyFactory.createProperty();
readAbstractProperty(property, reader);
policyProcessor.readPolicies(property, reader);
// Read the property value
Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
property.setValue(value);
componentType.getProperties().add(property);
} else if (Constants.IMPLEMENTATION_QNAME.equals(name)) {
// Read an <implementation> element
policyProcessor.readPolicies(componentType, reader);