protected IntegrationDeployment loadDeployment() throws IOException { final IntegrationDeployment deployment; try (InputStream is = ResourceHelper.resolveResourceAsInputStream(getContext().getClassResolver(), configurationUri)) { if (is != null) { LOGGER.info("Loading integration from: {}", configurationUri); deployment = Json.mapper().readValue(is, IntegrationDeployment.class); } else { throw new IllegalStateException("Unable to load deployment: " + configurationUri); } } return deployment; }
protected Integration loadIntegration() throws IOException { final Integration integration; try (InputStream is = ResourceHelper.resolveResourceAsInputStream(getContext().getClassResolver(), configurationUri)) { if (is != null) { LOGGER.info("Loading integration from: {}", configurationUri); integration = Json.reader().forType(Integration.class).readValue(is); } else { throw new IllegalStateException("Unable to load deployment: " + configurationUri); } } return integration; }
private void loadFragments(Step step) { if (StepKind.extension != step.getStepKind()) { return; } final StepAction action = step.getAction().filter(StepAction.class::isInstance).map(StepAction.class::cast).get(); if (action.getDescriptor().getKind() == StepAction.Kind.ENDPOINT) { final CamelContext context = getContext(); final String resource = action.getDescriptor().getResource(); if (ObjectHelper.isNotEmpty(resource) && resources.add(resource)) { final Object instance = mandatoryLoadResource(context, resource); final RoutesDefinition definitions = mandatoryConvertToRoutesDefinition(resource, instance); LOGGER.debug("Resolved resource: {} as {}", resource, instance.getClass()); try { context.addRouteDefinitions(definitions.getRoutes()); } catch (Exception e) { throw new IllegalStateException(e); } } } }
final RuntimeCamelCatalog catalog = builder.getContext().getRuntimeCamelCatalog(); final String uri = catalog.asEndpointUri(componentScheme, Map.class.cast(properties), false);
@Override public Optional<ProcessorDefinition<?>> handle(Step step, ProcessorDefinition<?> route, IntegrationRouteBuilder builder, String flowIndex, String stepIndex) { ObjectHelper.notNull(route, "route"); final String expression = ObjectHelper.notNull(getFilterExpression(step), "expression"); final CamelContext context = builder.getContext(); final Predicate predicate = new JsonSimplePredicate(expression, context); final FilterDefinition filter = route.filter(predicate); return Optional.of(filter); }
final RuntimeCamelCatalog catalog = builder.getContext().getRuntimeCamelCatalog(); final String uri = catalog.asEndpointUri(componentScheme, Map.class.cast(properties), false);
@Override public Optional<ProcessorDefinition> handle(Step step, ProcessorDefinition route, IntegrationRouteBuilder builder) { ObjectHelper.notNull(route, "route"); final FilterStep filterStep = (FilterStep)step; final String expression = ObjectHelper.notNull(filterStep.getFilterExpression(), "expression"); final CamelContext context = builder.getContext(); final Predicate predicate = new JsonSimplePredicate(expression, context); final FilterDefinition filter = route.filter(predicate); return Optional.of(filter); } }
/** * If the integration has a scheduler, start the route with a timer or quartz2 * endpoint. */ private ProcessorDefinition<?> configureRouteScheduler(final Flow flow) throws URISyntaxException { if (flow.getScheduler().isPresent()) { Scheduler scheduler = flow.getScheduler().get(); // We now support simple timer only, cron support will be supported // later on. if (scheduler.isTimer()) { Map<String, String> properties = new HashMap<>(); properties.put("timerName", "integration"); properties.put("period", scheduler.getExpression()); final RuntimeCamelCatalog catalog = getContext().getRuntimeCamelCatalog(); final String uri = catalog.asEndpointUri("timer", properties, false); RouteDefinition route = this.from(uri); route.getInputs().get(0).setId("integration-scheduler"); flow.getId().ifPresent(route::setId); return route; } else { throw new IllegalArgumentException("Unsupported scheduler type: " + scheduler.getType()); } } return null; }
final ModelCamelContext context = builder.getContext(); final Component component = context.getComponent(componentName); HandlerCustomizer.customizeComponent(context, connector, descriptor, component, new HashMap<>(properties));
final Language language = builder.getContext().resolveLanguage(languageName); final Expression expression = language.createExpression(expressionDefinition);
final Language language = builder.getContext().resolveLanguage(languageName); final Expression expression = language.createExpression(expressionDefinition);
final CamelContext context = builder.getContext(); final String componentId = scheme + "-" + index; final ComponentProxyComponent component = resolveComponent(componentId, scheme, context, descriptor);
final CamelContext context = builder.getContext(); final String componentId = scheme + "-" + flowIndex + "-" + stepIndex; final ComponentProxyComponent component = resolveComponent(componentId, scheme, context, connector, descriptor);
final CamelContext context = builder.getContext();
final CamelContext context = builder.getContext();