Java 类org.apache.camel.model.OnCompletionDefinition 实例源码

项目:Camel    文件:RouteService.java   
/**
 * Gather all other kind of route scoped services from the given route, except error handler
 */
private void doGetRouteScopedServices(List<Service> services, Route route) {
    for (ProcessorDefinition<?> output : route.getRouteContext().getRoute().getOutputs()) {
        if (output instanceof OnExceptionDefinition) {
            OnExceptionDefinition onExceptionDefinition = (OnExceptionDefinition) output;
            if (onExceptionDefinition.isRouteScoped()) {
                Processor errorHandler = onExceptionDefinition.getErrorHandler(route.getId());
                if (errorHandler != null && errorHandler instanceof Service) {
                    services.add((Service) errorHandler);
                }
            }
        } else if (output instanceof OnCompletionDefinition) {
            OnCompletionDefinition onCompletionDefinition = (OnCompletionDefinition) output;
            if (onCompletionDefinition.isRouteScoped()) {
                Processor onCompletionProcessor = onCompletionDefinition.getOnCompletion(route.getId());
                if (onCompletionProcessor != null && onCompletionProcessor instanceof Service) {
                    services.add((Service) onCompletionProcessor);
                }
            }
        }
    }
}
项目:Camel    文件:DefaultChannel.java   
private boolean isContextScoped() {
    if (definition instanceof OnExceptionDefinition) {
        return !((OnExceptionDefinition) definition).isRouteScoped();
    } else if (definition instanceof OnCompletionDefinition) {
        return !((OnCompletionDefinition) definition).isRouteScoped();
    }

    return false;
}
项目:Camel    文件:DefaultManagementLifecycleStrategy.java   
/**
 * Should the given processor be registered.
 */
protected boolean registerProcessor(ProcessorDefinition<?> processor) {
    // skip on exception
    if (processor instanceof OnExceptionDefinition) {
        return false;
    }
    // skip on completion
    if (processor instanceof OnCompletionDefinition) {
        return false;
    }
    // skip intercept
    if (processor instanceof InterceptDefinition) {
        return false;
    }
    // skip aop
    if (processor instanceof AOPDefinition) {
        return false;
    }
    // skip policy
    if (processor instanceof PolicyDefinition) {
        return false;
    }

    // only if custom id assigned
    boolean only = getManagementStrategy().getManagementAgent().getOnlyRegisterProcessorWithCustomId() != null
            && getManagementStrategy().getManagementAgent().getOnlyRegisterProcessorWithCustomId();
    if (only) {
        return processor.hasCustomIdAssigned();
    }

    // use customer filter
    return getManagementStrategy().manageProcessor(processor);
}
项目:Camel    文件:RouteBuilder.java   
/**
 * <a href="http://camel.apache.org/oncompletion.html">On completion</a>
 * callback for doing custom routing when the {@link org.apache.camel.Exchange} is complete.
 *
 * @return the builder
 */
public OnCompletionDefinition onCompletion() {
    // is only allowed at the top currently
    if (!getRouteCollection().getRoutes().isEmpty()) {
        throw new IllegalArgumentException("onCompletion must be defined before any routes in the RouteBuilder");
    }
    getRouteCollection().setCamelContext(getContext());
    return getRouteCollection().onCompletion();
}
项目:Camel    文件:CamelContextFactoryBean.java   
public List<OnCompletionDefinition> getOnCompletions() {
    return onCompletions;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
    this.onCompletions = onCompletions;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public List<OnCompletionDefinition> getOnCompletions() {
    return onCompletions;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
    this.onCompletions = onCompletions;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public List<OnCompletionDefinition> getOnCompletions() {
    return onCompletions;
}
项目:Camel    文件:CamelContextFactoryBean.java   
public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
    this.onCompletions = onCompletions;
}
项目:Camel    文件:CamelGroovyMethods.java   
public static OnCompletionDefinition onWhen(OnCompletionDefinition self, Closure<?> predicate) {
    return self.onWhen(toExpression(predicate));
}
项目:switchyard    文件:CamelContextFactoryBeanDelegate.java   
@Override
public List<OnCompletionDefinition> getOnCompletions() {
    return _factoryBean.getOnCompletions();
}
项目:camel-cdi    文件:CamelContextFactoryBean.java   
public List<OnCompletionDefinition> getOnCompletions() {
    return onCompletions;
}
项目:camel-cdi    文件:CamelContextFactoryBean.java   
public void setOnCompletions(List<OnCompletionDefinition> onCompletions) {
    this.onCompletions = onCompletions;
}
项目:Camel    文件:AbstractCamelContextFactoryBean.java   
public abstract List<OnCompletionDefinition> getOnCompletions();