org.apache.camel.tooling.model.JsonMapper Java Examples
The following examples show how to use
org.apache.camel.tooling.model.JsonMapper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelKafkaConnectorCreateMojo.java From camel-kafka-connector with Apache License 2.0 | 6 votes |
private void generateAndWritePom(String sanitizedName, File directory) throws Exception { //create initial connector pom ComponentModel cm = JsonMapper.generateComponentModel(componentJson); getLog().info("Creating a new pom.xml for the connector from scratch"); Template pomTemplate = MavenUtils.getTemplate(rm.getResourceAsFile(initialPomTemplate)); Map<String, String> props = new HashMap<>(); props.put("version", project.getVersion()); props.put("dependencyId", cm.getArtifactId()); props.put("dependencyGroup", cm.getGroupId()); props.put("componentName", name); props.put("componentSanitizedName", sanitizedName); props.put("componentDescription", name); try { Document pom = MavenUtils.createCrateXmlDocumentFromTemplate(pomTemplate, props); // Write the starter pom File pomFile = new File(directory, "pom.xml"); writeXmlFormatted(pom, pomFile, getLog()); } catch (Exception e) { getLog().error("Cannot create pom.xml file from Template: " + pomTemplate + " with properties: " + props, e); throw e; } }
Example #2
Source File: CamelKafkaConnectorUpdateMojo.java From camel-kafka-connector with Apache License 2.0 | 5 votes |
private void updateConnector() throws Exception { String sanitizedName = sanitizeMavenArtifactId(name); // create the starter directory File connectorDir = new File(projectDir, "camel-" + sanitizedName + KAFKA_CONNECTORS_SUFFIX); if (!connectorDir.exists() || !connectorDir.isDirectory()) { getLog().info("Connector " + name + " can not be updated since directory " + connectorDir.getAbsolutePath() + " dose not exist."); throw new MojoFailureException("Directory already exists: " + connectorDir); } // create the base pom.xml Document pom = createBasePom(connectorDir); // Apply changes to the starter pom fixExcludedDependencies(pom); fixAdditionalDependencies(pom, additionalDependencies); fixAdditionalRepositories(pom); // Write the starter pom File pomFile = new File(connectorDir, "pom.xml"); writeXmlFormatted(pom, pomFile, getLog()); // write package Document pkg = createPackageFile(); File pkgFile = new File(connectorDir, "src/main/assembly/package.xml"); writeXmlFormatted(pkg, pkgFile, getLog()); // write LICENSE, USAGE writeStaticFiles(connectorDir); // generate classes ComponentModel model = JsonMapper.generateComponentModel(componentJson); if (model.isConsumerOnly()) { createClasses(sanitizedName, connectorDir, model, ConnectorType.SOURCE); } else if (model.isProducerOnly()) { createClasses(sanitizedName, connectorDir, model, ConnectorType.SINK); } else { createClasses(sanitizedName, connectorDir, model, ConnectorType.SOURCE); createClasses(sanitizedName, connectorDir, model, ConnectorType.SINK); } }
Example #3
Source File: UpdateDocComponentsListMojo.java From camel-spring-boot with Apache License 2.0 | 4 votes |
private ComponentModel generateComponentModel(String json) { return JsonMapper.generateComponentModel(json); }
Example #4
Source File: UpdateDocComponentsListMojo.java From camel-spring-boot with Apache License 2.0 | 4 votes |
private DataFormatModel generateDataFormatModel(String json) { return JsonMapper.generateDataFormatModel(json); }
Example #5
Source File: UpdateDocComponentsListMojo.java From camel-spring-boot with Apache License 2.0 | 4 votes |
private LanguageModel generateLanguageModel(String json) { return JsonMapper.generateLanguageModel(json); }
Example #6
Source File: UpdateDocComponentsListMojo.java From camel-spring-boot with Apache License 2.0 | 4 votes |
private OtherModel generateOtherModel(String json) { return JsonMapper.generateOtherModel(json); }