}
// Populate ArtifactProcessor registry
DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(modelFactories);
ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
CompositeProcessor compositeProcessor = new CompositeProcessor(contributionFactory, assemblyFactory, policyFactory,
interfaceContractMapper, staxProcessor);
staxProcessors.addArtifactProcessor(compositeProcessor);
staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
staxProcessors.addArtifactProcessor(new JavaInterfaceProcessor(modelFactories));
staxProcessors.addArtifactProcessor(new JavaImplementationProcessor(modelFactories));
// Create a resolver
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
ModelResolverImpl resolver = new ModelResolverImpl(classLoader);
try {
// Read the composite files
List<Composite> composites = new ArrayList<Composite>();
for (String compositeFile: compositeFiles) {
InputStream is = classLoader.getResourceAsStream(compositeFile);
Composite composite = staxProcessor.read(is, Composite.class);
resolver.addModel(composite);
composites.add(composite);
}
for (Composite composite: composites) {
// Resolve the composite
compositeProcessor.resolve(composite, resolver);
}
// Wire the top level component's composite
buildComposite(composites.get(0), assemblyFactory, scaBindingFactory, interfaceContractMapper);