Java Code Examples for org.apache.camel.RuntimeCamelException#wrapRuntimeCamelException()

The following examples show how to use org.apache.camel.RuntimeCamelException#wrapRuntimeCamelException() . 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: ComponentProxyComponent.java    From syndesis with Apache License 2.0 6 votes vote down vote up
public ComponentProxyComponent(String componentId, String componentScheme, String componentClass, CamelCatalog catalog) {
    this.componentId = StringHelper.notEmpty(componentId, "componentId");
    this.componentScheme = StringHelper.notEmpty(componentScheme, "componentScheme");
    this.componentSchemeAlias = Optional.empty();
    this.configuredOptions = new HashMap<>();
    this.remainingOptions = new HashMap<>();
    this.catalog = ObjectHelper.notNull(catalog, "catalog");

    if (ObjectHelper.isNotEmpty(componentClass)) {
        this.catalog.addComponent(componentScheme, componentClass);
    }

    try {
        this.definition = ComponentDefinition.forScheme(catalog, componentScheme);
    } catch (IOException e) {
        throw RuntimeCamelException.wrapRuntimeCamelException(e);
    }

    registerExtension(this::getComponentVerifierExtension);
}
 
Example 2
Source File: SpringBootXmlCamelContextConfigurer.java    From camel-spring-boot with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(ApplicationContext applicationContext, SpringCamelContext camelContext) {
    CamelConfigurationProperties config = applicationContext.getBean(CamelConfigurationProperties.class);
    if (config != null) {
        try {
            LOG.debug("Merging XML based CamelContext with Spring Boot configuration properties");
            CamelAutoConfiguration.doConfigureCamelContext(applicationContext, camelContext, config);
        } catch (Exception e) {
            throw RuntimeCamelException.wrapRuntimeCamelException(e);
        }
    }
}
 
Example 3
Source File: RoutesConfigurer.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
protected void load(Runtime runtime, String[] routes) {
    for (String route: routes) {
        if (ObjectHelper.isEmpty(route)) {
            continue;
        }

        try {
            load(runtime, Sources.fromURI(route));
        } catch (Exception e) {
            throw RuntimeCamelException.wrapRuntimeCamelException(e);
        }

        LOGGER.info("Loading routes from: {}", route);
    }
}
 
Example 4
Source File: Runtime.java    From camel-k-runtime with Apache License 2.0 5 votes vote down vote up
default void addRoutes(RoutesBuilder builder) {
    try {
        getCamelContext().addRoutes(builder);
    } catch (Exception e) {
        throw RuntimeCamelException.wrapRuntimeCamelException(e);
    }
}
 
Example 5
Source File: IntegrationRouteBuilder.java    From syndesis with Apache License 2.0 5 votes vote down vote up
protected InputStream createIntegrationInputStream() throws IOException {
    if (sourceProvider != null) {
        try {
            return sourceProvider.getSource(getContext());
        } catch (Exception e) {
            throw RuntimeCamelException.wrapRuntimeCamelException(e);
        }
    }
    LOGGER.info("Loading integration from: {}", configurationUri);
    return ResourceHelper.resolveMandatoryResourceAsInputStream(getContext(), configurationUri);
}
 
Example 6
Source File: EMailComponent.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
protected ComponentDefinition getDefinition() {
    try {
        /*
         * The definition set on construction is the placeholder 'email'
         * so find the underlying defintion based on the specified protocol
         */
        return ComponentDefinition.forScheme(getCatalog(), getProtocol());
    } catch (IOException ex) {
        throw RuntimeCamelException.wrapRuntimeCamelException(ex);
    }
}