private void runPlugin() throws Exception {
    File rootDir = new File(camelCoreDir, pathToModelDir);
    Document document = XmlHelper.buildNamespaceAwareDocument(inputCamelSchemaFile);
    XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
    DomFinder domFinder = new DomFinder(document, xPath);
    DocumentationEnricher documentationEnricher = new DocumentationEnricher(document);
    Map<String, File> jsonFiles = PackageHelper.findJsonFiles(rootDir);

    NodeList elementsAndTypes = domFinder.findElementsAndTypes();
    documentationEnricher.enrichTopLevelElementsDocumentation(elementsAndTypes, jsonFiles);
    Map<String, String> typeToNameMap = buildTypeToNameMap(elementsAndTypes);
    Set<String> injectedTypes = new HashSet<String>();

    for (Map.Entry<String, String> entry : typeToNameMap.entrySet()) {
      String elementType = entry.getKey();
      String elementName = entry.getValue();
      if (jsonFileExistsForElement(jsonFiles, elementName)) {
        injectAttributesDocumentation(
            domFinder,
            documentationEnricher,
            jsonFiles.get(elementName),
            elementType,
            injectedTypes);
      }
    }

    saveToFile(document, outputCamelSchemaFile, XmlHelper.buildTransformer());
  }
  /** Recursively injects documentation to complex type attributes and it's parents. */
  private void injectAttributesDocumentation(
      DomFinder domFinder,
      DocumentationEnricher documentationEnricher,
      File jsonFile,
      String type,
      Set<String> injectedTypes)
      throws XPathExpressionException, IOException {
    if (injectedTypes.contains(type)) {
      return;
    }

    injectedTypes.add(type);
    NodeList attributeElements = domFinder.findAttributesElements(type);
    if (attributeElements.getLength() > 0) {
      documentationEnricher.enrichTypeAttributesDocumentation(attributeElements, jsonFile);
    }

    String baseType = domFinder.findBaseType(type);
    if (baseType != null && !StringUtils.isEmpty(baseType)) {
      baseType = truncateTypeNamespace(baseType);
      injectAttributesDocumentation(
          domFinder, documentationEnricher, jsonFile, baseType, injectedTypes);
    }
  }