org.apache.camel.NamedNode Java Examples

The following examples show how to use org.apache.camel.NamedNode. 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: ActivityTrackingInterceptStrategy.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Override
public Processor wrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, Processor nextTarget) {
    if (this.tracker == null) {
        return target;
    }

    if (shouldTrack(definition)) {
        final String id = definition.getId();
        if (ObjectHelper.isEmpty(id)) {
            return target;
        }

        final String stepId = StringHelper.after(id, "step:");
        if (ObjectHelper.isEmpty(stepId)) {
            return target;
        }

        if (shouldTrackDoneEvent(definition)) {
            return new TrackDoneEventProcessor(target, stepId);
        }

        return new TrackStartEventProcessor(target, stepId);
    }

    return target;
}
 
Example #2
Source File: ActivityTrackingInterceptStrategy.java    From syndesis with Apache License 2.0 6 votes vote down vote up
/**
 * Activities that do hold nested activities (such as {@link org.apache.camel.model.FilterDefinition}, {@link org.apache.camel.model.ChoiceDefinition})
 * should not track the done event because this leads to reversed order of log events.
 *
 * Only log done events with duration measurement for no output definitions like {@link org.apache.camel.model.ToDefinition}.
 */
private static boolean shouldTrackDoneEvent(NamedNode definition) {
    if (!(definition instanceof OutputDefinition)) {
      return false;
    }

    final OutputDefinition<?> outputDefinition = (OutputDefinition) definition;
    final List<ProcessorDefinition<?>> outputs = outputDefinition.getOutputs();

    if (ObjectHelper.isEmpty(outputs)) {
        return false;
    }

    int stepIndexInPipeline = 0;
    if (outputs.size() > 1) {
        // 1st output in the pipeline should be the set header processor for the step id
        // 2nd output in the pipeline should be the actual step processor
        stepIndexInPipeline = 1;
    }

    return outputs.get(stepIndexInPipeline) instanceof NoOutputDefinition ||
           outputs.get(stepIndexInPipeline) instanceof OutputExpressionNode;
}
 
Example #3
Source File: TracingInterceptStrategy.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Override
public Processor wrapProcessorInInterceptors(CamelContext context, NamedNode definition, Processor target, Processor nextTarget) throws Exception {
    if (definition instanceof PipelineDefinition) {
        final String id = definition.getId();
        if (ObjectHelper.isEmpty(id)) {
            return target;
        }

        final String stepId = StringHelper.after(id, "step:");
        if (ObjectHelper.isEmpty(stepId)) {
            return target;
        }

        return new EventProcessor(target, stepId);
    }
    return target;
}
 
Example #4
Source File: CustomProcessorFactory.java    From quarkus-in-prod with Apache License 2.0 5 votes vote down vote up
@Override
public Processor createProcessor(final RouteContext routeContext, final NamedNode definition)
    throws Exception {

    if (definition instanceof SendDefinition) {
        Endpoint endpoint = resolveEndpoint(routeContext, (SendDefinition) definition);
        return new CustomSendProcessor(endpoint, ((SendDefinition) definition).getPattern());
    }

    return null;
}
 
Example #5
Source File: WebhookRoutePolicyFactory.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
@Override
public RoutePolicy createRoutePolicy(CamelContext camelContext, String routeId, NamedNode route) {
    if (action != null) {
        return new WebhookRoutePolicy(camelContext, action);
    }
    return null;
}
 
Example #6
Source File: DisabledModelToXMLDumper.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public String dumpModelAsXml(CamelContext context, NamedNode definition) throws Exception {
    throw new UnsupportedOperationException("Please add a dependency to camel-quarkus-xml-jaxb");
}
 
Example #7
Source File: DisabledModelToXMLDumper.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public String dumpModelAsXml(CamelContext context, NamedNode definition, boolean resolvePlaceholders,
        boolean resolveDelegateEndpoints) throws Exception {
    throw new UnsupportedOperationException("Please add a dependency to camel-quarkus-xml-jaxb or camel-quarkus-xml-io");
}
 
Example #8
Source File: DisabledXMLRoutesDefinitionLoader.java    From camel-quarkus with Apache License 2.0 4 votes vote down vote up
@Override
public <T extends NamedNode> T createModelFromXml(CamelContext context, String xml, Class<T> type) throws Exception {
    throw new UnsupportedOperationException("Please add a dependency to camel-quarkus-xml-io");
}
 
Example #9
Source File: CustomProcessorFactory.java    From quarkus-in-prod with Apache License 2.0 4 votes vote down vote up
@Override
public Processor createChildProcessor(
    final RouteContext routeContext, final NamedNode definition, final boolean mandatory) throws Exception {
    return null;
}
 
Example #10
Source File: ActivityTrackingInterceptStrategy.java    From syndesis with Apache License 2.0 4 votes vote down vote up
/**
 * Activity tracking is only active for pipelines.
 */
private static boolean shouldTrack(NamedNode definition) {
    return definition instanceof PipelineDefinition &&
            ObjectHelper.isNotEmpty(((PipelineDefinition) definition).getOutputs());
}
 
Example #11
Source File: AbstractAuthorizationPolicy.java    From wildfly-camel with Apache License 2.0 4 votes vote down vote up
@Override
public void beforeWrap(Route route, NamedNode definition) {
}