writeIronjacamarXml

@param def       Definition
@param outputDir output directory
@throws IOException output exception
326997
private void writeIronjacamarXml(Definition def, String outputDir) throws IOException
   {
      FileWriter ijfw = Utils.createFile("ironjacamar.xml", outputDir + File.separatorChar + "META-INF");
      IronjacamarXmlGen ijxGen = new IronjacamarXmlGen();
      ijxGen.generate(def, ijfw);
      ijfw.close();
   }
480648
@Override
    public void writeXML(XMLOutput xmlOutput) throws IOException {
        xmlOutput.openCloseTag("Property",
                new XMLAttributeList().addAttribute("name", getName()).addAttribute("value", getValue()));
    }
70037
function writeClientLibXml(item, options) {
    var content = '<?xml version="1.0" encoding="UTF-8"?>' +
        '<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"' +
        ' jcr:primaryType="cq:ClientLibraryFolder"';

    if (item.hasOwnProperty('categories')) {
        var fieldValue = item.categories.join(',');
        content += ' categories="[' + fieldValue + ']"';
    } else {
        content += ' categories="[' + item.name + ']" ';
    }

    clientLibDirectoryFields.forEach(function (fieldKey) {
      if (item.hasOwnProperty(fieldKey)) {
          if (typeof item[fieldKey] === 'boolean') {
            // Boolean value
            content += ' ' + fieldKey + '="{Boolean}' + item[fieldKey] + '"';
          } else if (Array.isArray(item[fieldKey])) {
            // Array of strings
            var fieldValue = item[fieldKey].join(',');
            content += ' ' + fieldKey + '="[' + fieldValue + ']"';
          } else if (typeof item[fieldKey] === 'string') {
            // String value
            content += ' ' + fieldKey + '="' + item[fieldKey] + '"';
          }
      }
    });

    content += "/>";
    var outputPath = item.outputPath || path.join(item.path, item.name);
    var contentXml = path.join(outputPath + "/.content.xml");

    options.verbose && console.log("write clientlib json file: " + contentXml);

    fse.writeFileSync(contentXml, content);
}
140117
static Document loadDefinition(final File def) {
        // Parse the jDPL definition into a DOM tree.
        final Document document = XmlUtils.parseFile(def);
        if (document == null) {
            return null;
        }

        // Log the jPDL version from the process definition (if applicable and available).
        final Node xmlnsNode = document.getFirstChild().getAttributes().getNamedItem("xmlns");
        if (xmlnsNode != null && StringUtils.isNotBlank(xmlnsNode.getNodeValue()) && xmlnsNode.getNodeValue().contains("jpdl")) {
            final String version = xmlnsNode.getNodeValue().substring(xmlnsNode.getNodeValue().length() - 3);
            LOGGER.info("jPDL version == " + version);
        }

        return document;
    }
1336173
void writeClassComment(Definition def, Writer out) throws IOException
   {
      out.write("/**\n");
      out.write(" * " + getClassName(def));
      writeEol(out);
      out.write(" *\n");
      out.write(" * @version $Revision: $\n");
      out.write(" */\n");
   }
885688
private void writeClass(File directory, String name, ByteBuffer def) {
    writeClass(directory, name, def, computeClassDigest(def));
  }
844528
@Override
   public void writeXmlBody(Definition def, Writer out) throws IOException
   {
      writeConnectorVersion(out);

      int indent = 1;
      writeIndent(out, indent);
      out.write("<display-name>Display Name</display-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<vendor-name>Red Hat Inc</vendor-name>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<spec-version>1.0</spec-version>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<eis-type>Test RA</eis-type>");
      writeEol(out);
      writeIndent(out, indent);
      out.write("<version>0.1</version>");
      writeEol(out);

      writeIndent(out, indent);
      out.write("<resourceadapter>");
      writeEol(out);

      writeOutbound(def, out, indent + 1);

      writeIndent(out, indent);
      out.write("</resourceadapter>");
      writeEol(out);
      out.write("</connector>");
      writeEol(out);
   }
586020
private void generateReports(String outputDirectory) {
        logger.entering(outputDirectory);

        ClassLoader localClassLoader = this.getClass().getClassLoader();

        try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputDirectory + File.separator + "index.html"));
                BufferedWriter jsonWriter = new BufferedWriter(new FileWriter(outputDirectory + File.separator
                        + "report.json"));
                BufferedReader templateReader = new BufferedReader(new InputStreamReader(
                        localClassLoader.getResourceAsStream("templates/RuntimeReporter/index.html")));) {

            JsonObject reporter = buildJSONReport();
            Gson gson = new GsonBuilder().setPrettyPrinting().create();
            String jsonReport = gson.toJson(reporter);
            jsonWriter.write(jsonReport);
            jsonWriter.newLine();

            generateHTMLReport(writer, templateReader, jsonReport);

        } catch (IOException | JsonParseException e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
            throw new ReporterException(e);
        }

        logger.exiting();
    }
322185
public void writeXML(OutputStream outputStream, String encoding, String indent, String lineSeparator)
  throws IOException {
    XMLOutputter outputter = new XMLOutputter();
    Format format = Format.getPrettyFormat();
    format.setEncoding(encoding);
    format.setIndent(indent);
    format.setLineSeparator(lineSeparator);
    outputter.setFormat(format);
    outputter.output(getDocument(), outputStream);
  }
97843
public static void generate(Path outputDir) throws IOException {
    DataReader reader = DataReader.get();
    CalendarCodeGenerator datetimeGenerator = new CalendarCodeGenerator();
    Map<LocaleID, ClassName> dateClasses = datetimeGenerator.generate(outputDir, reader);

    PluralCodeGenerator pluralGenerator = new PluralCodeGenerator();
    pluralGenerator.generate(outputDir, reader);

    NumberCodeGenerator numberGenerator = new NumberCodeGenerator();
    Map<LocaleID, ClassName> numberClasses = numberGenerator.generate(outputDir, reader);
    
    LanguageCodeGenerator languageGenerator = new LanguageCodeGenerator();
    languageGenerator.generate(outputDir, reader);
    
    MethodSpec registerCalendars = indexFormatters("registerCalendars", "registerCalendarFormatter", dateClasses);
    MethodSpec registerNumbers = indexFormatters("registerNumbers", "registerNumberFormatter", numberClasses);
    
    MethodSpec constructor = MethodSpec.constructorBuilder()
        .addModifiers(PRIVATE)
        .build();

    FieldSpec instance = FieldSpec.builder(CLDR, "instance", PRIVATE, STATIC, FINAL)
        .build();

    MethodSpec getter = MethodSpec.methodBuilder("get")
        .addModifiers(PUBLIC, STATIC)
        .returns(CLDR)
        .addStatement("return instance")
        .build();

    TypeSpec.Builder type = TypeSpec.classBuilder("CLDR")
        .addModifiers(PUBLIC)
        .superclass(CLDR_BASE)
        .addMethod(constructor)
        .addMethod(getter)
        .addMethod(registerCalendars)
        .addMethod(registerNumbers);

    Set<LocaleID> availableLocales = reader.availableLocales()
        .stream()
        .map(s -> LocaleID.parse(s))
        .collect(Collectors.toSet());
    
    createLocales(type, reader.defaultContent(), availableLocales);
    createLanguageAliases(type, reader.languageAliases());
    createTerritoryAliases(type, reader.territoryAliases());
    createLikelySubtags(type, reader.likelySubtags());
    createCurrencies(type, numberGenerator.getCurrencies(reader));
    
    addPluralRules(type);

    // Initialize all static maps.
    type.addStaticBlock(CodeBlock.builder()
      .addStatement("registerCalendars()")
      .addStatement("registerNumbers()")
      .addStatement("registerDefaultContent()")
      .addStatement("registerLanguageAliases()")
      .addStatement("registerTerritoryAliases()")
      .addStatement("registerLikelySubtags()")
      .addStatement("instance = new CLDR()").build());
    
    type.addField(instance);

    saveClass(outputDir, PACKAGE_CLDR, "CLDR", type.build());
  }
404316
public void create(String outputdir, Program program) {
		types.stream().forEach((type) -> type.createOutput(outputdir, program));
	}
713512
public void write(DataOutput out) throws IOException {
    out.writeLong(version);
    Text.writeString(out, dir);
    out.writeLong(gen);
  }
1202508
public static void writeXml(Serializable serializable, OutputStream output) throws IOException {
		TransportFormat.XML.writeSerializableTo(serializable, output);
	}
541812
public void writeXML(File file) throws IOException {
        OutputStream out = new FileOutputStream(file);
        if (file.getName().endsWith(".gz")) {
            out = new GZIPOutputStream(out);
        }
        writeXML(out);
    }
125393
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      out.write("public class " + getClassName(def));
      writeLeftCurlyBracket(out, 0);
      writeEol(out);

      int indent = 1;

      writeWithIndent(out, indent, "/** The resource adapter */\n");
      writeWithIndent(out, indent, "private " + def.getRaClass() + " ra;\n\n");

      writeWithIndent(out, indent, "/** Activation spec */\n");
      writeWithIndent(out, indent, "private " + def.getAsClass() + " spec;\n\n");

      writeWithIndent(out, indent, "/** The message endpoint factory */\n");
      writeWithIndent(out, indent, "private MessageEndpointFactory endpointFactory;\n\n");

      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Default constructor\n");
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n");
      writeWithIndent(out, indent, " */\n");
      writeWithIndent(out, indent, "public " + getClassName(def) + "() throws ResourceException");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this(null, null, null);");
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      //constructor
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Constructor\n");
      writeWithIndent(out, indent, " * @param ra " + def.getRaClass());
      writeEol(out);
      writeWithIndent(out, indent, " * @param endpointFactory MessageEndpointFactory\n");
      writeWithIndent(out, indent, " * @param spec " + def.getAsClass());
      writeEol(out);
      writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getRaClass() + " ra, \n");
      writeWithIndent(out, indent + 1, "MessageEndpointFactory endpointFactory,\n");
      writeWithIndent(out, indent + 1, def.getAsClass() + " spec) throws ResourceException\n");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.ra = ra;\n");
      writeWithIndent(out, indent + 1, "this.endpointFactory = endpointFactory;\n");
      writeWithIndent(out, indent + 1, "this.spec = spec;");
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeGetAs(def, out, indent);
      writeMef(def, out, indent);
      writeStartStop(def, out, indent);

      writeRightCurlyBracket(out, 0);
   }
463818
@Override
   public void writeImport(Definition def, Writer out) throws IOException
   {
      out.write("package " + def.getRaPackage() + ";\n\n");
      out.write("import javax.naming.NamingException;\n");
      out.write("import javax.naming.Reference;\n\n");
      out.write("import javax.resource.ResourceException;\n");
      out.write("import javax.resource.cci.Connection;\n");
      out.write("import javax.resource.cci.ConnectionFactory;\n");
      out.write("import javax.resource.cci.ConnectionSpec;\n");
      out.write("import javax.resource.cci.RecordFactory;\n");
      out.write("import javax.resource.cci.ResourceAdapterMetaData;\n");
      out.write("import javax.resource.spi.ConnectionManager;\n\n");
      if (def.getMcfDefs().size() != 1)
         out.write("import " + def.getRaPackage() + ".*;\n\n");
   }
805580
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {

      out.write("public class " + getClassName(def) + " implements " +
            def.getMcfDefs().get(getNumOfMcf()).getCfInterfaceClass());
      writeLeftCurlyBracket(out, 0);
      int indent = 1;

      writeWithIndent(out, indent, "/** The serial version UID */\n");
      writeWithIndent(out, indent, "private static final long serialVersionUID = 1L;\n\n");

      writeWithIndent(out, indent, "/** The logger */\n");
      writeWithIndent(out, indent, "private static Logger log = Logger.getLogger(" + getSelfClassName(def) + ");\n\n");

      writeWithIndent(out, indent, "/** Reference */\n");
      writeWithIndent(out, indent, "private Reference reference;\n\n");

      writeWithIndent(out, indent, "/** ManagedConnectionFactory */\n");
      writeWithIndent(out, indent, "private " + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() + " mcf;\n\n");

      writeWithIndent(out, indent, "/** ConnectionManager */\n");
      writeWithIndent(out, indent, "private ConnectionManager connectionManager;\n\n");

      writeDefaultConstructor(def, out, indent);

      //constructor
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Default constructor\n");
      writeWithIndent(out, indent, " * @param mcf ManagedConnectionFactory\n");
      writeWithIndent(out, indent, " * @param cxManager ConnectionManager\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent,
            "public " + getClassName(def) + "(" + def.getMcfDefs().get(getNumOfMcf()).getMcfClass() +
                  " mcf, ConnectionManager cxManager)");
      writeLeftCurlyBracket(out, indent);
      writeWithIndent(out, indent + 1, "this.mcf = mcf;\n");
      writeWithIndent(out, indent + 1, "this.connectionManager = cxManager;");
      writeRightCurlyBracket(out, indent);
      writeEol(out);

      writeConnection(def, out, indent);
      writeReference(def, out, indent);
      writeRightCurlyBracket(out, 0);
   }