public void process(Contribution contribution, IntrospectionContext context) {
    try {
      Source source = contribution.getSource();
      Composite composite = loaderRegistry.load(source, Composite.class, context);
      QName name = composite.getName();

      Resource resource = new Resource(contribution, source, "application/xml");
      QNameSymbol symbol = new QNameSymbol(name);
      ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol);
      element.setValue(composite);
      resource.addResourceElement(element);
      resource.setState(ResourceState.PROCESSED);

      contribution.addResource(resource);

      ContributionManifest manifest = contribution.getManifest();
      Deployable deployable = new Deployable(name);
      manifest.addDeployable(deployable);

      QNameExport export = new QNameExport(name.getNamespaceURI());
      manifest.addExport(export);
    } catch (LoaderException e) {
      throw new Fabric3Exception(e);
    }
  }
 @SuppressWarnings({"unchecked"})
 public void process(Resource resource, IntrospectionContext context) {
   Source source = resource.getSource();
   ClassLoader classLoader = context.getClassLoader();
   URI contributionUri = context.getContributionUri();
   URL location = source.getBaseLocation();
   IntrospectionContext childContext =
       new DefaultIntrospectionContext(contributionUri, classLoader, location);
   Composite composite;
   try {
     // check to see if the resource has already been evaluated
     composite = loader.load(source, Composite.class, childContext);
   } catch (LoaderException e) {
     throw new Fabric3Exception(e);
   }
   if (composite == null) {
     // composite could not be parsed
     InvalidXmlArtifact error = new InvalidXmlArtifact("Invalid composite: " + location, null);
     context.addError(error);
     return;
   }
   boolean found = false;
   for (ResourceElement element : resource.getResourceElements()) {
     if (element.getSymbol().getKey().equals(composite.getName())) {
       element.setValue(composite);
       found = true;
       break;
     }
   }
   if (!found) {
     // should not happen
     String identifier = composite.getName().toString();
     throw new AssertionError("Resource element not found: " + identifier);
   }
   if (childContext.hasErrors()) {
     context.addErrors(childContext.getErrors());
   }
   if (childContext.hasWarnings()) {
     context.addWarnings(childContext.getWarnings());
   }
   resource.setState(ResourceState.PROCESSED);
 }