@Override public ConnectorAction get(String id) { ConnectorAction result = Getter.super.get(id); if (result == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } if (result.getDescriptor().getConnectorId().equals(connectorId)){ return result; } throw new WebApplicationException(Response.Status.NOT_FOUND); }
@Override public boolean canHandle(Step step) { if (!"endpoint".equals(step.getStepKind()) && !"connector".equals(step.getStepKind())) { return false; } if (step.getConnection().isPresent()) { return false; } if (!step.getAction().filter(ConnectorAction.class::isInstance).isPresent()) { return false; } ConnectorAction action = step.getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).get(); if (action.getDescriptor() == null) { return false; } return action.getDescriptor().getComponentScheme().isPresent(); }
@Override public boolean canHandle(Step step) { if (!"endpoint".equals(step.getStepKind()) && !"connector".equals(step.getStepKind())) { return false; } if (!step.getConnection().isPresent()) { return false; } if (!step.getConnection().get().getConnector().isPresent()) { return false; } if (!step.getAction().filter(ConnectorAction.class::isInstance).isPresent()) { return false; } return !Optionals.first( step.getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).get().getDescriptor().getComponentScheme(), step.getConnection().get().getConnector().get().getComponentScheme() ).isPresent(); }
@Override public Collection<io.syndesis.integration.model.steps.Step> visit(StepVisitorContext visitorContext) { final List<io.syndesis.integration.model.steps.Step> steps = new ArrayList<>(); final Step step = visitorContext.getStep(); final Connection connection = step.getConnection().orElseThrow(() -> new IllegalArgumentException("Missing connection for step:" + step)); final Connector connector = resolveConnector(connection, visitorContext.getGeneratorContext().getDataManager()); final ConnectorAction action = step.getAction() .filter(ConnectorAction.class::isInstance) .map(ConnectorAction.class::cast) .orElseThrow(() -> new IllegalArgumentException("Missing action for step:" + step)); if (Optionals.first(action.getDescriptor().getComponentScheme(), connector.getComponentScheme()).isPresent()) { // Connector steps.add(createConnector(visitorContext, step, connection, connector, action)); } else { // Endpoint steps.add(createEndpoint(visitorContext, step, connection, connector, action)); } // Add an inline splitter if defined action.getDescriptor().getSplit() .map(this::createSplitter) .ifPresent(steps::add); return steps; }
@Override public boolean canHandle(Step step) { if (!"endpoint".equals(step.getStepKind()) && !"connector".equals(step.getStepKind())) { return false; } if (!step.getConnection().isPresent()) { return false; } if (!step.getConnection().get().getConnector().isPresent()) { return false; } if (!step.getAction().filter(ConnectorAction.class::isInstance).isPresent()) { return false; } return Optionals.first( step.getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).get().getDescriptor().getComponentScheme(), step.getConnection().get().getConnector().get().getComponentScheme() ).isPresent(); }
final ConnectorDescriptor descriptor = action.getDescriptor(); final String componentScheme = action.getDescriptor().getComponentScheme().get(); final Map<String, String> configuredProperties = step.getConfiguredProperties(); final Map<String, String> properties = action.filterEndpointProperties(configuredProperties);
@SuppressWarnings("unchecked") private io.syndesis.integration.model.steps.Step createConnector(StepVisitorContext visitorContext, Step step, Connection connection, Connector connector, ConnectorAction action) { final Map<String, String> properties = aggregate(connection.getConfiguredProperties(), step.getConfiguredProperties()); final String scheme = Optionals.first(action.getDescriptor().getComponentScheme(), connector.getComponentScheme()).get(); // if the option is marked as secret use property placeholder as the // value is added to the integration secret. if (visitorContext.getGeneratorContext().getGeneratorProperties().isSecretMaskingEnabled()) { properties.entrySet() .stream() .filter(Predicates.or(connector::isSecret, action::isSecret)) .forEach(e -> e.setValue(String.format("{{%s-%d.%s}}", scheme, visitorContext.getIndex(), e.getKey()))); } //Connector/Action properties have the precedence connector.getConfiguredProperties().forEach(properties::put); action.getDescriptor().getConfiguredProperties().forEach(properties::put); return new io.syndesis.camel.component.proxy.runtime.Connector( scheme + "-" + visitorContext.getIndex(), scheme, Map.class.cast(properties), Optionals.first(action.getDescriptor().getConnectorFactory(), connector.getConnectorFactory()).orElse(null), action.getDescriptor().getConnectorCustomizers() ); }
final Connection connection = step.getConnection().get(); final ConnectorAction action = ConnectorAction.class.cast(step.getAction().get()); final ConnectorDescriptor descriptor = action.getDescriptor(); final Connector connector = resolveConnector(connection, dataManager);
final Connector connector = connection.getConnector().get(); final ConnectorAction action = step.getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).get(); final ConnectorDescriptor descriptor = action.getDescriptor(); final String componentScheme = action.getDescriptor().getCamelConnectorPrefix(); final Map<String, String> configuredProperties = CollectionsUtils.aggregate(connection.getConfiguredProperties(), step.getConfiguredProperties()); final Map<String, String> properties = CollectionsUtils.aggregate(connector.filterEndpointProperties(configuredProperties), action.filterEndpointProperties(configuredProperties));
@SuppressWarnings("unchecked") private io.syndesis.integration.model.steps.Step createEndpoint(StepVisitorContext visitorContext, Step step, Connection connection, Connector connector, ConnectorAction action) { final Map<String, String> configuredProperties = aggregate(connection.getConfiguredProperties(), step.getConfiguredProperties()); final Map<String, String> properties = aggregate(connector.filterEndpointProperties(configuredProperties), action.filterEndpointProperties(configuredProperties)); final String componentScheme = action.getDescriptor().getCamelConnectorPrefix(); // if the option is marked as secret use property placeholder as the // value is added to the integration secret. if (visitorContext.getGeneratorContext().getGeneratorProperties().isSecretMaskingEnabled()) { properties.entrySet() .stream() .filter(Predicates.or(connector::isEndpointProperty, action::isEndpointProperty)) .filter(Predicates.or(connector::isSecret, action::isSecret)) .forEach(e -> e.setValue(String.format("{{%s-%d.%s}}", componentScheme, visitorContext.getIndex(), e.getKey()))); } // any configuredProperties on action descriptor are considered final ConnectorDescriptor descriptor = action.getDescriptor(); properties.putAll(descriptor.getConfiguredProperties()); if (hasComponentProperties(configuredProperties, connector, action)) { return new io.syndesis.integration.model.steps.Endpoint(String.format("%s-%d", componentScheme, visitorContext.getIndex()), Map.class.cast(properties)); } else { return new io.syndesis.integration.model.steps.Endpoint(componentScheme, Map.class.cast(properties)); } }
final Connector connector = connection.getConnector().get(); final ConnectorAction action = step.getAction().filter(ConnectorAction.class::isInstance).map(ConnectorAction.class::cast).get(); final ConnectorDescriptor descriptor = action.getDescriptor();
.orElseThrow(() -> new EntityNotFoundException("Action with id: " + id)); final ConnectorDescriptor defaultDescriptor = action.getDescriptor();
@Override public ListResult<ConnectorAction> list(UriInfo uriInfo) { return getDataManager().fetchAll( ConnectorAction.class, new PredicateFilter<>(o -> o.getDescriptor().getConnectorId().equals(connectorId)), new ReflectiveSorter<>(ConnectorAction.class, new SortOptionsFromQueryParams(uriInfo)), new PaginationFilter<>(new PaginationOptionsFromQueryParams(uriInfo)) ); } }
"descriptor"); assertThat(generatedAction.getDescriptor().getPropertyDefinitionSteps()) .as("Generated and expected action definition property definition steps for action with id: " + actionId + " differs") .isEqualTo(expectedAction.getDescriptor().getPropertyDefinitionSteps()); if (expectedAction.getDescriptor().getInputDataShape().isPresent()) { final DataShape generatedInputDataShape = generatedAction.getDescriptor().getInputDataShape().get(); final DataShape expectedInputDataShape = expectedAction.getDescriptor().getInputDataShape().get(); if (expectedAction.getDescriptor().getOutputDataShape().isPresent()) { final DataShape generatedOutputDataShape = generatedAction.getDescriptor().getOutputDataShape().get(); final DataShape expectedOutputDataShape = expectedAction.getDescriptor().getOutputDataShape().get(); assertThat(generatedOutputDataShape) .as("Generated and expected output data shape for action with id: " + actionId + " differs")