Skip to content

Commit

Permalink
Add type information to catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton authored and lburgazzoli committed Dec 2, 2019
1 parent f7aeec6 commit f9d62a3
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ private void processComponents(org.apache.camel.catalog.CamelCatalog catalog, Ma
.filter(Objects::nonNull)
.forEach(artifact::createScheme);

artifact.addJavaType(definition.getJavaType());

return artifact;
});
}
Expand All @@ -268,6 +270,7 @@ private void processLanguages(org.apache.camel.catalog.CamelCatalog catalog, Map
}

artifact.addLanguage(definition.getName());
artifact.addJavaType(definition.getJavaType());

return artifact;
});
Expand All @@ -290,6 +293,7 @@ private void processDataFormats(org.apache.camel.catalog.CamelCatalog catalog, M
}

artifact.addDataformats(definition.getName());
artifact.addJavaType(definition.getJavaType());

return artifact;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ public class CamelArtifact extends Artifact {
private List<String> dataformats;
private List<Artifact> dependencies;
private List<Artifact> exclusions;
private List<String> javaTypes;

public CamelArtifact() {
this.schemes = new ArrayList<>();
this.languages = new ArrayList<>();
this.dataformats = new ArrayList<>();
this.dependencies = new ArrayList<>();
this.exclusions = new ArrayList<>();
this.javaTypes = new ArrayList<>();
}

public void setSchemes(List<CamelScheme> schemes) {
Expand Down Expand Up @@ -151,6 +153,20 @@ public void addExclusion(String groupId, String artifactId) {
addExclusion(artifact);
}

public List<String> getJavaTypes() {
return javaTypes;
}

public void setJavaTypes(List<String> javaTypes) {
this.javaTypes = javaTypes;
}

public void addJavaType(String javaType) {
if (!this.javaTypes.contains(javaType)) {
this.javaTypes.add(javaType);
}
}

@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public final class CatalogComponentDefinition {
private String artifactId;
private String version;
private String alternativeSchemes;
private String javaType;

public Stream<String> getSchemes() {
String schemeIDs = StringUtils.trimToEmpty(alternativeSchemes);
Expand Down Expand Up @@ -80,6 +81,14 @@ public void setAlternativeSchemes(String alternativeSchemes) {
this.alternativeSchemes = alternativeSchemes;
}

public String getJavaType() {
return javaType;
}

public void setJavaType(String javaType) {
this.javaType = javaType;
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Container {
private CatalogComponentDefinition delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public final class CatalogDataFormatDefinition {
private String groupId;
private String artifactId;
private String version;
private String javaType;

public String getName() {
return name;
Expand Down Expand Up @@ -59,6 +60,14 @@ public void setVersion(String version) {
this.version = version;
}

public String getJavaType() {
return javaType;
}

public void setJavaType(String javaType) {
this.javaType = javaType;
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Container {
private CatalogDataFormatDefinition delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public final class CatalogLanguageDefinition {
private String groupId;
private String artifactId;
private String version;
private String javaType;

public String getName() {
return name;
Expand Down Expand Up @@ -59,6 +60,14 @@ public void setVersion(String version) {
this.version = version;
}

public String getJavaType() {
return javaType;
}

public void setJavaType(String javaType) {
this.javaType = javaType;
}

@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Container {
private CatalogLanguageDefinition delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.camel.catalog.CamelCatalog;
import org.apache.camel.catalog.DefaultCamelCatalog;

public abstract class AbstractCataloProcessorTest {
public abstract class AbstractCatalogProcessorTest {
protected CamelCatalog versionCamelCatalog(String version) {
return new DefaultCamelCatalog() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import static org.assertj.core.api.Assertions.assertThat;

public class CatalogProcessor3Test extends AbstractCataloProcessorTest {
public class CatalogProcessor3Test extends AbstractCatalogProcessorTest {
@Test
public void testAcceptHyphen() {
CatalogProcessor3x cp3 = new CatalogProcessor3x();
Expand Down

0 comments on commit f9d62a3

Please sign in to comment.