Skip to content

Commit

Permalink
Regen
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Sep 21, 2020
1 parent 1a45f53 commit 176cbfb
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,52 +15,109 @@
@SuppressWarnings("unchecked")
public class KnativeComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {

private org.apache.camel.component.knative.KnativeConfiguration getOrCreateConfiguration(KnativeComponent target) {
if (target.getConfiguration() == null) {
target.setConfiguration(new org.apache.camel.component.knative.KnativeConfiguration());
}
return target.getConfiguration();
}

@Override
public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
KnativeComponent target = (KnativeComponent) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "apiversion":
case "apiVersion": getOrCreateConfiguration(target).setApiVersion(property(camelContext, java.lang.String.class, value)); return true;
case "basicpropertybinding":
case "basicPropertyBinding": target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); return true;
case "bridgeerrorhandler":
case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
case "ceoverride":
case "ceOverride": getOrCreateConfiguration(target).setCeOverride(property(camelContext, java.util.Map.class, value)); return true;
case "cloudeventsspecversion":
case "cloudEventsSpecVersion": getOrCreateConfiguration(target).setCloudEventsSpecVersion(property(camelContext, java.lang.String.class, value)); return true;
case "cloudeventstype":
case "cloudEventsType": getOrCreateConfiguration(target).setCloudEventsType(property(camelContext, java.lang.String.class, value)); return true;
case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.knative.KnativeConfiguration.class, value)); return true;
case "environment": getOrCreateConfiguration(target).setEnvironment(property(camelContext, org.apache.camel.component.knative.spi.KnativeEnvironment.class, value)); return true;
case "environmentpath":
case "environmentPath": target.setEnvironmentPath(property(camelContext, java.lang.String.class, value)); return true;
case "filters": getOrCreateConfiguration(target).setFilters(property(camelContext, java.util.Map.class, value)); return true;
case "kind": getOrCreateConfiguration(target).setKind(property(camelContext, java.lang.String.class, value)); return true;
case "lazystartproducer":
case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
case "reply": getOrCreateConfiguration(target).setReply(property(camelContext, java.lang.Boolean.class, value)); return true;
case "replywithcloudevent":
case "replyWithCloudEvent": getOrCreateConfiguration(target).setReplyWithCloudEvent(property(camelContext, boolean.class, value)); return true;
case "servicename":
case "serviceName": getOrCreateConfiguration(target).setServiceName(property(camelContext, java.lang.String.class, value)); return true;
case "transport": target.setTransport(property(camelContext, org.apache.camel.component.knative.spi.KnativeTransport.class, value)); return true;
case "transportoptions":
case "transportOptions": target.setTransportOptions(property(camelContext, java.util.Map.class, value)); return true;
case "transportoptions":
case "transportOptions": getOrCreateConfiguration(target).setTransportOptions(property(camelContext, java.util.Map.class, value)); return true;
default: return false;
}
}

@Override
public Map<String, Object> getAllOptions(Object target) {
Map<String, Object> answer = new CaseInsensitiveMap();
answer.put("apiVersion", java.lang.String.class);
answer.put("basicPropertyBinding", boolean.class);
answer.put("bridgeErrorHandler", boolean.class);
answer.put("ceOverride", java.util.Map.class);
answer.put("cloudEventsSpecVersion", java.lang.String.class);
answer.put("cloudEventsType", java.lang.String.class);
answer.put("configuration", org.apache.camel.component.knative.KnativeConfiguration.class);
answer.put("environment", org.apache.camel.component.knative.spi.KnativeEnvironment.class);
answer.put("environmentPath", java.lang.String.class);
answer.put("filters", java.util.Map.class);
answer.put("kind", java.lang.String.class);
answer.put("lazyStartProducer", boolean.class);
answer.put("reply", java.lang.Boolean.class);
answer.put("replyWithCloudEvent", boolean.class);
answer.put("serviceName", java.lang.String.class);
answer.put("transport", org.apache.camel.component.knative.spi.KnativeTransport.class);
answer.put("transportOptions", java.util.Map.class);
answer.put("transportOptions", java.util.Map.class);
return answer;
}

@Override
public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
KnativeComponent target = (KnativeComponent) obj;
switch (ignoreCase ? name.toLowerCase() : name) {
case "apiversion":
case "apiVersion": return getOrCreateConfiguration(target).getApiVersion();
case "basicpropertybinding":
case "basicPropertyBinding": return target.isBasicPropertyBinding();
case "bridgeerrorhandler":
case "bridgeErrorHandler": return target.isBridgeErrorHandler();
case "ceoverride":
case "ceOverride": return getOrCreateConfiguration(target).getCeOverride();
case "cloudeventsspecversion":
case "cloudEventsSpecVersion": return getOrCreateConfiguration(target).getCloudEventsSpecVersion();
case "cloudeventstype":
case "cloudEventsType": return getOrCreateConfiguration(target).getCloudEventsType();
case "configuration": return target.getConfiguration();
case "environment": return getOrCreateConfiguration(target).getEnvironment();
case "environmentpath":
case "environmentPath": return target.getEnvironmentPath();
case "filters": return getOrCreateConfiguration(target).getFilters();
case "kind": return getOrCreateConfiguration(target).getKind();
case "lazystartproducer":
case "lazyStartProducer": return target.isLazyStartProducer();
case "reply": return getOrCreateConfiguration(target).getReply();
case "replywithcloudevent":
case "replyWithCloudEvent": return getOrCreateConfiguration(target).isReplyWithCloudEvent();
case "servicename":
case "serviceName": return getOrCreateConfiguration(target).getServiceName();
case "transport": return target.getTransport();
case "transportoptions":
case "transportOptions": return target.getTransportOptions();
case "transportoptions":
case "transportOptions": return getOrCreateConfiguration(target).getTransportOptions();
default: return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,23 @@
"lenientProperties": false
},
"componentProperties": {
"ceOverride": { "kind": "property", "displayName": "Ce Override", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "ce.override.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "CloudEvent headers to override" },
"cloudEventsSpecVersion": { "kind": "property", "displayName": "Cloud Events Spec Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "enum": [ "0.1", "0.2", "0.3", "1.0" ], "deprecated": false, "secret": false, "defaultValue": "1.0", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the version of the cloudevents spec." },
"cloudEventsType": { "kind": "property", "displayName": "Cloud Events Type", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "org.apache.camel.event", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the event-type information of the produced events." },
"configuration": { "kind": "property", "displayName": "Configuration", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.KnativeConfiguration", "deprecated": false, "secret": false, "description": "Set the configuration." },
"environment": { "kind": "property", "displayName": "Environment", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeEnvironment", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The environment" },
"environmentPath": { "kind": "property", "displayName": "Environment Path", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "description": "The path ot the environment definition" },
"transport": { "kind": "property", "displayName": "Transport", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeTransport", "deprecated": false, "secret": false, "defaultValue": "http", "description": "The transport implementation." },
"transportOptions": { "kind": "property", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "deprecated": false, "secret": false, "description": "Transport options." },
"filters": { "kind": "property", "displayName": "Filters", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "filter.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the filters." },
"serviceName": { "kind": "property", "displayName": "Service Name", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The name of the service to lookup from the KnativeEnvironment." },
"transport": { "kind": "property", "displayName": "Transport", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.KnativeTransport", "deprecated": false, "secret": false, "description": "The transport implementation." },
"transportOptions": { "kind": "property", "displayName": "Transport Options", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "transport.", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Set the transport options." },
"bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored." },
"replyWithCloudEvent": { "kind": "property", "displayName": "Reply With Cloud Event", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": "false", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "Transforms the reply into a cloud event that will be processed by the caller. When listening to events from a Knative Broker, if this flag is enabled, replies will be published to the same Broker where the request comes from (beware that if you don't change the type of the received message, you may create a loop and receive your same reply). When this flag is disabled, CloudEvent headers are removed from the reply." },
"reply": { "kind": "property", "displayName": "Reply", "group": "consumer (advanced)", "label": "consumer,advanced", "required": false, "type": "boolean", "javaType": "java.lang.Boolean", "deprecated": false, "secret": false, "defaultValue": "true", "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "If the consumer should construct a full reply to knative request." },
"lazyStartProducer": { "kind": "property", "displayName": "Lazy Start Producer", "group": "producer", "label": "producer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing." },
"basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" }
"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The version of the k8s resource referenced by the endpoint." },
"basicPropertyBinding": { "kind": "property", "displayName": "Basic Property Binding", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "Whether the component should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities" },
"kind": { "kind": "property", "displayName": "Kind", "group": "advanced", "label": "advanced", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "configurationClass": "org.apache.camel.component.knative.KnativeConfiguration", "configurationField": "configuration", "description": "The type of the k8s resource referenced by the endpoint." }
},
"properties": {
"type": { "kind": "path", "displayName": "Type", "group": "common", "label": "", "required": false, "type": "object", "javaType": "org.apache.camel.component.knative.spi.Knative.Type", "enum": [ "endpoint", "channel", "event" ], "deprecated": false, "secret": false, "description": "The Knative resource type" },
Expand Down

0 comments on commit 176cbfb

Please sign in to comment.