pair(one.getKind(), another.getKind(), "kind"), pair(one.getEntrypoint(), another.getEntrypoint(), "entry-point"), pair(one.getResource(), another.getResource(), "resource"), pair(one.getInputDataShape(), another.getInputDataShape(), "input-data-shape"), pair(one.getOutputDataShape(), another.getOutputDataShape(), "output-data-shape"), pair(one.getPropertyDefinitionSteps(), another.getPropertyDefinitionSteps(), "property-definition-steps"));
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); } } } }
private void from(Object object) { if (object instanceof StepDescriptor) { StepDescriptor instance = (StepDescriptor) object; String resourceValue = instance.getResource(); if (resourceValue != null) { resource(resourceValue); } StepAction.Kind kindValue = instance.getKind(); if (kindValue != null) { kind(kindValue); } String entrypointValue = instance.getEntrypoint(); if (entrypointValue != null) { entrypoint(entrypointValue); } } if (object instanceof ActionDescriptor) { ActionDescriptor instance = (ActionDescriptor) object; Optional<DataShape> inputDataShapeOptional = instance.getInputDataShape(); if (inputDataShapeOptional.isPresent()) { inputDataShape(inputDataShapeOptional); } Optional<DataShape> outputDataShapeOptional = instance.getOutputDataShape(); if (outputDataShapeOptional.isPresent()) { outputDataShape(outputDataShapeOptional); } addAllPropertyDefinitionSteps(instance.getPropertyDefinitionSteps()); } }
final CamelContext context = builder.getContext(); if (action.getDescriptor().getKind() == StepAction.Kind.ENDPOINT) { for (Map.Entry<String, String> entry: properties.entrySet()) { route.setHeader(entry.getKey(), builder.constant(entry.getValue())); route = route.to(action.getDescriptor().getEntrypoint()); } else if (action.getDescriptor().getKind() == StepAction.Kind.BEAN) { String method = null; String function = action.getDescriptor().getEntrypoint(); String options = null; } else if (action.getDescriptor().getKind() == StepAction.Kind.STEP) { final String target = action.getDescriptor().getEntrypoint(); final TypeConverter converter = context.getTypeConverter();
private ImmutableStepDescriptor(ImmutableStepDescriptor.Builder builder) { this.kind = builder.kind; this.entrypoint = builder.entrypoint; this.resource = builder.resource; this.inputDataShape = builder.inputDataShape; this.outputDataShape = builder.outputDataShape; this.propertyDefinitionSteps = builder.propertyDefinitionStepsIsSet() ? createUnmodifiableList(true, builder.propertyDefinitionSteps) : createUnmodifiableList(false, createSafeList(StepDescriptor.super.getPropertyDefinitionSteps(), true, false)); }
public StepDescriptor.Builder replaceConfigurationProperty(final String propertyName, final Consumer<ConfigurationProperty.Builder> configurationPropertyConfigurator) { final StepDescriptor definition = build(); final List<ActionDescriptorStep> steps = definition.getPropertyDefinitionSteps(); int stepIdx; ActionDescriptorStep step = null; for (stepIdx = 0; stepIdx < steps.size(); stepIdx++) { final ActionDescriptorStep potentialStep = steps.get(stepIdx); final Map<String, ConfigurationProperty> properties = potentialStep.getProperties(); if (properties.containsKey(propertyName)) { step = potentialStep; break; } } if (step == null) { // found no property to replace, lets just ignore it return this; } final ConfigurationProperty configurationProperty = step.getProperties().get(propertyName); final ConfigurationProperty.Builder configurationPropertyModifier = new ConfigurationProperty.Builder().createFrom(configurationProperty); configurationPropertyConfigurator.accept(configurationPropertyModifier); final ActionDescriptorStep.Builder stepModifier = new ActionDescriptorStep.Builder() .createFrom(step) .putProperty(propertyName, configurationPropertyModifier.build()); final List<ActionDescriptorStep> modifiedSteps = new ArrayList<>(steps); modifiedSteps.set(stepIdx, stepModifier.build()); return propertyDefinitionSteps(modifiedSteps); } }