Skip to content

Commit

Permalink
camel-jbang - Transform to load blueprint and ignore some blueprint s…
Browse files Browse the repository at this point in the history
…tuff
  • Loading branch information
davsclaus committed Oct 2, 2023
1 parent ddc95bb commit b8328fe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@

public abstract class ProcessorReifier<T extends ProcessorDefinition<?>> extends AbstractReifier {

private static final Logger LOG = LoggerFactory.getLogger(ProcessorReifier.class);

/**
* Global option on {@link CamelContext#getGlobalOptions()} that tooling can use to disable all route processors,
* which allows to startup Camel without wiring up and initializing all route EIPs that may use custom processors,
Expand All @@ -136,6 +134,8 @@ public abstract class ProcessorReifier<T extends ProcessorDefinition<?>> extends
*/
public static final String DISABLE_ALL_PROCESSORS = "DisableAllProcessors";

private static final Logger LOG = LoggerFactory.getLogger(ProcessorReifier.class);

// for custom reifiers
private static final Map<Class<?>, BiFunction<Route, ProcessorDefinition<?>, ProcessorReifier<? extends ProcessorDefinition<?>>>> PROCESSORS
= new HashMap<>(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ protected void doAddInitialProperty(KameletMain main) {
main.addInitialProperty("camel.main.dumpRoutesUriAsParameters", "" + uriAsParameters);
main.addInitialProperty("camel.main.dumpRoutesOutput", target);
main.addInitialProperty("camel.jbang.transform", "true");
main.addInitialProperty("camel.component.properties.ignoreMissingProperty", "true");
if (ignoreLoadingError) {
// turn off bean method validator if ignore loading error
main.addInitialProperty("camel.language.bean.validate", "false");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,27 @@ public XmlModelParser(Resource input, String namespace) throws IOException, XmlP

@Override
protected boolean handleUnexpectedElement(String namespace, String name) throws XmlPullParserException {
if (isWithinCamelContext(namespace, name)) {
if (isWithinCamelContext(namespace, name) || isAriesBlueprint(namespace)) {
return true;
}
return super.handleUnexpectedElement(namespace, name);
}

@Override
protected boolean ignoreUnexpectedElement(String namespace, String name) throws XmlPullParserException {
if (isWithinCamelContext(namespace, name)) {
if (isWithinCamelContext(namespace, name) || isAriesBlueprint(namespace)) {
return true;
}
return super.ignoreUnexpectedElement(namespace, name);
}

private boolean isAriesBlueprint(String namespace) {
if (namespace != null && namespace.startsWith("http://aries.apache.org/blueprint/")) {
return true;
}
return false;
}

private boolean isWithinCamelContext(String namespace, String name) {
// accept embedded <camelContext> inside Spring XML <beans> files or OSGi <blueprint> files,
// so we can discover embedded <routes> inside this <camelContext>.
Expand Down

0 comments on commit b8328fe

Please sign in to comment.