This is an automated email from the ASF dual-hosted git repository. marat pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-karavan.git
commit ad9f755dae67a7c6a9353b3e0a004e186280c724 Author: Marat Gubaidullin <[email protected]> AuthorDate: Mon Jul 15 12:00:16 2024 -0400 Fix #1339 --- karavan-core/src/core/api/CamelDefinitionApi.ts | 24 +++++----- .../src/core/api/CamelDefinitionYamlStep.ts | 54 +++++++++++----------- karavan-core/src/core/api/TopologyUtils.ts | 27 +---------- karavan-core/src/core/model/CamelDefinition.ts | 43 +++++++++-------- karavan-core/src/core/model/CamelMetadata.ts | 40 +++++++++------- karavan-core/src/core/model/ComponentModels.ts | 2 + karavan-generator/dependency-reduced-pom.xml | 4 +- karavan-generator/pom.xml | 2 +- .../camel/karavan/generator/AbstractGenerator.java | 11 ----- 9 files changed, 93 insertions(+), 114 deletions(-) diff --git a/karavan-core/src/core/api/CamelDefinitionApi.ts b/karavan-core/src/core/api/CamelDefinitionApi.ts index ae7016fd..60f1b5a2 100644 --- a/karavan-core/src/core/api/CamelDefinitionApi.ts +++ b/karavan-core/src/core/api/CamelDefinitionApi.ts @@ -821,23 +821,23 @@ export class CamelDefinitionApi { if (element?.customLoadBalancer !== undefined) { def.customLoadBalancer = CamelDefinitionApi.createCustomLoadBalancerDefinition(element.customLoadBalancer); } - if (element?.failover !== undefined) { - def.failover = CamelDefinitionApi.createFailoverLoadBalancerDefinition(element.failover); + if (element?.failoverLoadBalancer !== undefined) { + def.failoverLoadBalancer = CamelDefinitionApi.createFailoverLoadBalancerDefinition(element.failoverLoadBalancer); } - if (element?.random !== undefined) { - def.random = CamelDefinitionApi.createRandomLoadBalancerDefinition(element.random); + if (element?.randomLoadBalancer !== undefined) { + def.randomLoadBalancer = CamelDefinitionApi.createRandomLoadBalancerDefinition(element.randomLoadBalancer); } - if (element?.roundRobin !== undefined) { - def.roundRobin = CamelDefinitionApi.createRoundRobinLoadBalancerDefinition(element.roundRobin); + if (element?.roundRobinLoadBalancer !== undefined) { + def.roundRobinLoadBalancer = CamelDefinitionApi.createRoundRobinLoadBalancerDefinition(element.roundRobinLoadBalancer); } - if (element?.sticky !== undefined) { - def.sticky = CamelDefinitionApi.createStickyLoadBalancerDefinition(element.sticky); + if (element?.stickyLoadBalancer !== undefined) { + def.stickyLoadBalancer = CamelDefinitionApi.createStickyLoadBalancerDefinition(element.stickyLoadBalancer); } - if (element?.topic !== undefined) { - def.topic = CamelDefinitionApi.createTopicLoadBalancerDefinition(element.topic); + if (element?.topicLoadBalancer !== undefined) { + def.topicLoadBalancer = CamelDefinitionApi.createTopicLoadBalancerDefinition(element.topicLoadBalancer); } - if (element?.weighted !== undefined) { - def.weighted = CamelDefinitionApi.createWeightedLoadBalancerDefinition(element.weighted); + if (element?.weightedLoadBalancer !== undefined) { + def.weightedLoadBalancer = CamelDefinitionApi.createWeightedLoadBalancerDefinition(element.weightedLoadBalancer); } def.steps = CamelDefinitionApi.createSteps(element?.steps); return def; diff --git a/karavan-core/src/core/api/CamelDefinitionYamlStep.ts b/karavan-core/src/core/api/CamelDefinitionYamlStep.ts index 2b2b2e4b..7dac57d7 100644 --- a/karavan-core/src/core/api/CamelDefinitionYamlStep.ts +++ b/karavan-core/src/core/api/CamelDefinitionYamlStep.ts @@ -1331,11 +1331,18 @@ export class CamelDefinitionYamlStep { static readLoadBalanceDefinition = (element: any): LoadBalanceDefinition => { let def = element ? new LoadBalanceDefinition({...element}) : new LoadBalanceDefinition(); - if (element?.random !== undefined) { - if (Array.isArray(element.random)) { - def.random = CamelDefinitionYamlStep.readRandomLoadBalancerDefinition(element.random[0]); + if (element?.roundRobinLoadBalancer !== undefined) { + if (Array.isArray(element.roundRobinLoadBalancer)) { + def.roundRobinLoadBalancer = CamelDefinitionYamlStep.readRoundRobinLoadBalancerDefinition(element.roundRobinLoadBalancer[0]); } else { - def.random = CamelDefinitionYamlStep.readRandomLoadBalancerDefinition(element.random); + def.roundRobinLoadBalancer = CamelDefinitionYamlStep.readRoundRobinLoadBalancerDefinition(element.roundRobinLoadBalancer); + } + } + if (element?.stickyLoadBalancer !== undefined) { + if (Array.isArray(element.stickyLoadBalancer)) { + def.stickyLoadBalancer = CamelDefinitionYamlStep.readStickyLoadBalancerDefinition(element.stickyLoadBalancer[0]); + } else { + def.stickyLoadBalancer = CamelDefinitionYamlStep.readStickyLoadBalancerDefinition(element.stickyLoadBalancer); } } if (element?.customLoadBalancer !== undefined) { @@ -1345,40 +1352,33 @@ export class CamelDefinitionYamlStep { def.customLoadBalancer = CamelDefinitionYamlStep.readCustomLoadBalancerDefinition(element.customLoadBalancer); } } - if (element?.failover !== undefined) { - if (Array.isArray(element.failover)) { - def.failover = CamelDefinitionYamlStep.readFailoverLoadBalancerDefinition(element.failover[0]); - } else { - def.failover = CamelDefinitionYamlStep.readFailoverLoadBalancerDefinition(element.failover); - } - } - if (element?.sticky !== undefined) { - if (Array.isArray(element.sticky)) { - def.sticky = CamelDefinitionYamlStep.readStickyLoadBalancerDefinition(element.sticky[0]); + if (element?.topicLoadBalancer !== undefined) { + if (Array.isArray(element.topicLoadBalancer)) { + def.topicLoadBalancer = CamelDefinitionYamlStep.readTopicLoadBalancerDefinition(element.topicLoadBalancer[0]); } else { - def.sticky = CamelDefinitionYamlStep.readStickyLoadBalancerDefinition(element.sticky); + def.topicLoadBalancer = CamelDefinitionYamlStep.readTopicLoadBalancerDefinition(element.topicLoadBalancer); } } - if (element?.topic !== undefined) { - if (Array.isArray(element.topic)) { - def.topic = CamelDefinitionYamlStep.readTopicLoadBalancerDefinition(element.topic[0]); + if (element?.failoverLoadBalancer !== undefined) { + if (Array.isArray(element.failoverLoadBalancer)) { + def.failoverLoadBalancer = CamelDefinitionYamlStep.readFailoverLoadBalancerDefinition(element.failoverLoadBalancer[0]); } else { - def.topic = CamelDefinitionYamlStep.readTopicLoadBalancerDefinition(element.topic); + def.failoverLoadBalancer = CamelDefinitionYamlStep.readFailoverLoadBalancerDefinition(element.failoverLoadBalancer); } } - if (element?.weighted !== undefined) { - if (Array.isArray(element.weighted)) { - def.weighted = CamelDefinitionYamlStep.readWeightedLoadBalancerDefinition(element.weighted[0]); + if (element?.weightedLoadBalancer !== undefined) { + if (Array.isArray(element.weightedLoadBalancer)) { + def.weightedLoadBalancer = CamelDefinitionYamlStep.readWeightedLoadBalancerDefinition(element.weightedLoadBalancer[0]); } else { - def.weighted = CamelDefinitionYamlStep.readWeightedLoadBalancerDefinition(element.weighted); + def.weightedLoadBalancer = CamelDefinitionYamlStep.readWeightedLoadBalancerDefinition(element.weightedLoadBalancer); } } def.steps = CamelDefinitionYamlStep.readSteps(element?.steps); - if (element?.roundRobin !== undefined) { - if (Array.isArray(element.roundRobin)) { - def.roundRobin = CamelDefinitionYamlStep.readRoundRobinLoadBalancerDefinition(element.roundRobin[0]); + if (element?.randomLoadBalancer !== undefined) { + if (Array.isArray(element.randomLoadBalancer)) { + def.randomLoadBalancer = CamelDefinitionYamlStep.readRandomLoadBalancerDefinition(element.randomLoadBalancer[0]); } else { - def.roundRobin = CamelDefinitionYamlStep.readRoundRobinLoadBalancerDefinition(element.roundRobin); + def.randomLoadBalancer = CamelDefinitionYamlStep.readRandomLoadBalancerDefinition(element.randomLoadBalancer); } } diff --git a/karavan-core/src/core/api/TopologyUtils.ts b/karavan-core/src/core/api/TopologyUtils.ts index 4ec740a9..a579d578 100644 --- a/karavan-core/src/core/api/TopologyUtils.ts +++ b/karavan-core/src/core/api/TopologyUtils.ts @@ -55,8 +55,7 @@ export class TopologyUtils { static isElementInternalComponent = (element: CamelElement): boolean => { const uri = (element as any).uri; const component = ComponentApi.findByName(uri); - return component !== undefined && - (TopologyUtils.isComponentInternal(component.component.label) || TopologyUtils.hasInternalUri(element)); + return component !== undefined && component.component.remote !== true; } static getConnectorType = (element: CamelElement): 'component' | 'kamelet' => { @@ -101,30 +100,6 @@ export class TopologyUtils { return result.endsWith("&") ? result.substring(0, result.length - 1) : result; } - static isComponentInternal = (label: string): boolean => { - const labels = label.split(","); - if (labels.includes('core') && ( - labels.includes('transformation') - || labels.includes('testing') - || labels.includes('scheduling') - || labels.includes('monitoring') - || labels.includes('transformation') - || labels.includes('java') - || labels.includes('endpoint') - || labels.includes('script') - || labels.includes('validation') - )) { - return true; - } else if (label === 'transformation') { - return true; - } - return false; - } - - static hasInternalUri = (element: CamelElement): boolean => { - return this.hasDirectUri(element) || this.hasSedaUri(element); - } - static hasDirectUri = (element: CamelElement): boolean => { return this.hasUriStartWith(element, 'direct'); } diff --git a/karavan-core/src/core/model/CamelDefinition.ts b/karavan-core/src/core/model/CamelDefinition.ts index 3d98fa54..755bc633 100644 --- a/karavan-core/src/core/model/CamelDefinition.ts +++ b/karavan-core/src/core/model/CamelDefinition.ts @@ -108,6 +108,7 @@ export class ErrorHandlerDeserializer extends CamelElement { noErrorHandler?: NoErrorHandlerDefinition; refErrorHandler?: RefErrorHandlerDefinition | string; springTransactionErrorHandler?: SpringTransactionErrorHandlerDefinition; + id?: string = 'errorHandlerDeserializer-' + uuidv4().substring(0,4); public constructor(init?: Partial<ErrorHandlerDeserializer>) { super('ErrorHandlerDeserializer'); Object.assign(this, init); @@ -597,12 +598,12 @@ export class LoadBalanceDefinition extends CamelElement { disabled?: boolean; inheritErrorHandler?: boolean; customLoadBalancer?: CustomLoadBalancerDefinition | string; - failover?: FailoverLoadBalancerDefinition; - random?: RandomLoadBalancerDefinition; - roundRobin?: RoundRobinLoadBalancerDefinition; - sticky?: StickyLoadBalancerDefinition; - topic?: TopicLoadBalancerDefinition; - weighted?: WeightedLoadBalancerDefinition; + failoverLoadBalancer?: FailoverLoadBalancerDefinition; + randomLoadBalancer?: RandomLoadBalancerDefinition; + roundRobinLoadBalancer?: RoundRobinLoadBalancerDefinition; + stickyLoadBalancer?: StickyLoadBalancerDefinition; + topicLoadBalancer?: TopicLoadBalancerDefinition; + weightedLoadBalancer?: WeightedLoadBalancerDefinition; steps?: CamelElement[] = []; public constructor(init?: Partial<LoadBalanceDefinition>) { super('LoadBalanceDefinition'); @@ -3098,8 +3099,8 @@ export class CustomLoadBalancerDefinition extends CamelElement { } export class FailoverLoadBalancerDefinition extends CamelElement { - stepName?: string = 'failover'; - id?: string = 'failover-' + uuidv4().substring(0,4); + stepName?: string = 'failoverLoadBalancer'; + id?: string = 'failoverLoadBalancer-' + uuidv4().substring(0,4); exception?: string[] = []; roundRobin?: string; sticky?: string; @@ -3111,8 +3112,8 @@ export class FailoverLoadBalancerDefinition extends CamelElement { } export class RandomLoadBalancerDefinition extends CamelElement { - stepName?: string = 'random'; - id?: string = 'random-' + uuidv4().substring(0,4); + stepName?: string = 'randomLoadBalancer'; + id?: string = 'randomLoadBalancer-' + uuidv4().substring(0,4); public constructor(init?: Partial<RandomLoadBalancerDefinition>) { super('RandomLoadBalancerDefinition'); Object.assign(this, init); @@ -3120,8 +3121,8 @@ export class RandomLoadBalancerDefinition extends CamelElement { } export class RoundRobinLoadBalancerDefinition extends CamelElement { - stepName?: string = 'roundRobin'; - id?: string = 'roundRobin-' + uuidv4().substring(0,4); + stepName?: string = 'roundRobinLoadBalancer'; + id?: string = 'roundRobinLoadBalancer-' + uuidv4().substring(0,4); public constructor(init?: Partial<RoundRobinLoadBalancerDefinition>) { super('RoundRobinLoadBalancerDefinition'); Object.assign(this, init); @@ -3129,8 +3130,8 @@ export class RoundRobinLoadBalancerDefinition extends CamelElement { } export class StickyLoadBalancerDefinition extends CamelElement { - stepName?: string = 'sticky'; - id?: string = 'sticky-' + uuidv4().substring(0,4); + stepName?: string = 'stickyLoadBalancer'; + id?: string = 'stickyLoadBalancer-' + uuidv4().substring(0,4); correlationExpression?: ExpressionSubElementDefinition; public constructor(init?: Partial<StickyLoadBalancerDefinition>) { super('StickyLoadBalancerDefinition'); @@ -3139,8 +3140,8 @@ export class StickyLoadBalancerDefinition extends CamelElement { } export class TopicLoadBalancerDefinition extends CamelElement { - stepName?: string = 'topic'; - id?: string = 'topic-' + uuidv4().substring(0,4); + stepName?: string = 'topicLoadBalancer'; + id?: string = 'topicLoadBalancer-' + uuidv4().substring(0,4); public constructor(init?: Partial<TopicLoadBalancerDefinition>) { super('TopicLoadBalancerDefinition'); Object.assign(this, init); @@ -3148,8 +3149,8 @@ export class TopicLoadBalancerDefinition extends CamelElement { } export class WeightedLoadBalancerDefinition extends CamelElement { - stepName?: string = 'weighted'; - id?: string = 'weighted-' + uuidv4().substring(0,4); + stepName?: string = 'weightedLoadBalancer'; + id?: string = 'weightedLoadBalancer-' + uuidv4().substring(0,4); distributionRatio: string = ''; distributionRatioDelimiter?: string; roundRobin?: boolean; @@ -3212,6 +3213,7 @@ export class DeleteDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; @@ -3240,6 +3242,7 @@ export class GetDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; @@ -3268,6 +3271,7 @@ export class HeadDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; @@ -3366,6 +3370,7 @@ export class PatchDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; @@ -3394,6 +3399,7 @@ export class PostDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; @@ -3422,6 +3428,7 @@ export class PutDefinition extends CamelElement { enableNoContentResponse?: boolean; apiDocs?: boolean; deprecated?: boolean; + streamCache?: boolean; routeId?: string; param?: ParamDefinition[] = []; responseMessage?: ResponseMessageDefinition[] = []; diff --git a/karavan-core/src/core/model/CamelMetadata.ts b/karavan-core/src/core/model/CamelMetadata.ts index 3259bb39..9a9b8e6e 100644 --- a/karavan-core/src/core/model/CamelMetadata.ts +++ b/karavan-core/src/core/model/CamelMetadata.ts @@ -1187,12 +1187,12 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('disabled', 'Disabled', "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('inheritErrorHandler', 'Inherit Error Handler', "Sets whether or not to inherit the configured error handler. The default value is true. You can use this to disable using the inherited error handler for a given DSL such as a load balancer where you want to use a custom error handler strategy.", 'boolean', '', 'false', false, false, false, false, '', ''), new PropertyMeta('customLoadBalancer', 'customLoadBalancer', "customLoadBalancer", 'CustomLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('failover', 'failover', "failover", 'FailoverLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('random', 'random', "random", 'RandomLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('roundRobin', 'roundRobin', "roundRobin", 'RoundRobinLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('sticky', 'sticky', "sticky", 'StickyLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('topic', 'topic', "topic", 'TopicLoadBalancerDefinition', '', '', false, false, false, true, '', ''), - new PropertyMeta('weighted', 'weighted', "weighted", 'WeightedLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('failoverLoadBalancer', 'failoverLoadBalancer', "failoverLoadBalancer", 'FailoverLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('randomLoadBalancer', 'randomLoadBalancer', "randomLoadBalancer", 'RandomLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('roundRobinLoadBalancer', 'roundRobinLoadBalancer', "roundRobinLoadBalancer", 'RoundRobinLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('stickyLoadBalancer', 'stickyLoadBalancer', "stickyLoadBalancer", 'StickyLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('topicLoadBalancer', 'topicLoadBalancer', "topicLoadBalancer", 'TopicLoadBalancerDefinition', '', '', false, false, false, true, '', ''), + new PropertyMeta('weightedLoadBalancer', 'weightedLoadBalancer', "weightedLoadBalancer", 'WeightedLoadBalancerDefinition', '', '', false, false, false, true, '', ''), new PropertyMeta('steps', 'steps', "steps", 'CamelElement', '', '', false, false, true, true, '', ''), ], [ ]), @@ -1350,7 +1350,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('id', 'Id', "Sets the id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('description', 'Description', "Sets the description of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('disabled', 'Disabled', "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), - new PropertyMeta('ref', 'Ref', "Reference to the Processor to lookup in the registry to use. Can also be used for creating new beans by their class name by prefixing with #class, eg #class:com.foo.MyClassType. And it is also possible to refer to singleton beans by their type in the registry by prefixing with #type: syntax, eg #type:com.foo.MyClassType", 'string', '', '', true, false, false, false, '', 'org.apache.camel.Processor'), + new PropertyMeta('ref', 'Ref', "Reference to the Processor to lookup in the registry to use. A Processor is a class of type org.apache.camel.Processor, which can are to be called by this EIP. In this processor you have custom Java code, that can work with the message, such as to do custom business logic, special message manipulations and so on. By default, the ref, will lookup the bean in the Camel registry. The ref can use prefix that controls how the processor is obtained. You [...] ], [ ]), new ElementMeta('recipientList', 'RecipientListDefinition', 'Recipient List', "Route messages to a number of dynamically specified recipients", 'eip,routing', [ @@ -1509,7 +1509,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('id', 'Id', "Sets the id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('description', 'Description', "Sets the description of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('disabled', 'Disabled', "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), - new PropertyMeta('headers', 'headers', "headers", 'SetHeaderDefinition', '', '', false, false, true, true, '', ''), + new PropertyMeta('headers', 'Headers', "Contains the headers to be set", 'SetHeaderDefinition', '', '', true, false, true, true, '', ''), ], [ ]), new ElementMeta('setProperty', 'SetPropertyDefinition', 'Set Property', "Sets a named property on the message exchange", 'eip,transformation', [ @@ -1532,7 +1532,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('id', 'Id', "Sets the id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('description', 'Description', "Sets the description of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('disabled', 'Disabled', "Whether to disable this EIP from the route during build time. Once an EIP has been disabled then it cannot be enabled later at runtime.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), - new PropertyMeta('variables', 'variables', "variables", 'SetVariableDefinition', '', '', false, false, true, true, '', ''), + new PropertyMeta('variables', 'Variables', "Contains the variables to be set", 'SetVariableDefinition', '', '', true, false, true, true, '', ''), ], [ ]), new ElementMeta('sort', 'SortDefinition', 'Sort', "Sorts the contents of the message", 'eip,routing', [ @@ -1897,7 +1897,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('apiContextPath', 'Api Context Path', "Sets a leading context-path the REST API will be using. This can be used when using components such as camel-servlet where the deployed web application is deployed using a context-path.", 'string', '', '', false, false, false, false, 'consumer', ''), new PropertyMeta('apiContextRouteId', 'Api Context Route Id', "Sets the route id to use for the route that services the REST API. The route will by default use an auto assigned route id.", 'string', '', '', false, false, false, false, 'consumer,advanced', ''), new PropertyMeta('apiVendorExtension', 'Api Vendor Extension', "Whether vendor extension is enabled in the Rest APIs. If enabled then Camel will include additional information as vendor extension (eg keys starting with x-) such as route ids, class names etc. Not all 3rd party API gateways and tools supports vendor-extensions when importing your API docs.", 'boolean', '', 'false', false, false, false, false, 'consumer,advanced', ''), - new PropertyMeta('hostNameResolver', 'Host Name Resolver', "If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using.", 'string', 'allLocalIp, localHostName, localIp', 'allLocalIp', false, false, false, false, 'consumer,advanced', ''), + new PropertyMeta('hostNameResolver', 'Host Name Resolver', "If no hostname has been explicit configured, then this resolver is used to compute the hostname the REST service will be using.", 'string', 'allLocalIp, localHostName, localIp, none', 'allLocalIp', false, false, false, false, 'consumer,advanced', ''), new PropertyMeta('bindingMode', 'Binding Mode', "Sets the binding mode to use. The default value is off", 'string', 'off, auto, json, xml, json_xml', 'off', false, false, false, false, '', ''), new PropertyMeta('bindingPackageScan', 'Binding Package Scan', "Package name to use as base (offset) for classpath scanning of POJO classes are located when using binding mode is enabled for JSon or XML. Multiple package names can be separated by comma.", 'string', '', '', false, false, false, false, 'consumer,advanced', ''), new PropertyMeta('skipBindingOnErrorCode', 'Skip Binding On Error Code', "Whether to skip binding on output if there is a custom HTTP error code header. This allows to build custom error messages that do not bind to json / xml etc, as success messages otherwise will do.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), @@ -2313,32 +2313,32 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('ref', 'Ref', "Refers to the custom load balancer to lookup from the registry", 'string', '', '', true, false, false, false, '', ''), ], [ ]), - new ElementMeta('failover', 'FailoverLoadBalancerDefinition', 'Failover', "In case of failures the exchange will be tried on the next endpoint.", 'eip,routing', [ + new ElementMeta('failoverLoadBalancer', 'FailoverLoadBalancerDefinition', 'Failover Load Balancer', "In case of failures the exchange will be tried on the next endpoint.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('exception', 'Exception', "A list of class names for specific exceptions to monitor. If no exceptions are configured then all exceptions are monitored", 'string', '', '', false, false, true, true, '', ''), new PropertyMeta('roundRobin', 'Round Robin', "Whether or not the failover load balancer should operate in round robin mode or not. If not, then it will always start from the first endpoint when a new message is to be processed. In other words it restart from the top for every message. If round robin is enabled, then it keeps state and will continue with the next endpoint in a round robin fashion. You can also enable sticky mode together with round robin, if so then it will pick [...] new PropertyMeta('sticky', 'Sticky', "Whether or not the failover load balancer should operate in sticky mode or not. If not, then it will always start from the first endpoint when a new message is to be processed. In other words it restart from the top for every message. If sticky is enabled, then it keeps state and will continue with the last known good endpoint. You can also enable sticky mode together with round robin, if so then it will pick the last known good endpoint to u [...] - new PropertyMeta('maximumFailoverAttempts', 'Maximum Failover Attempts', "A value to indicate after X failover attempts we should exhaust (give up). Use -1 to indicate never give up and continuously try to failover. Use 0 to never failover. And use e.g. 3 to failover at most 3 times before giving up. his option can be used whether or not roundRobin is enabled or not.", 'string', '', '-1', false, false, false, false, '', ''), + new PropertyMeta('maximumFailoverAttempts', 'Maximum Failover Attempts', "A value to indicate after X failover attempts we should exhaust (give up). Use -1 to indicate never give up and continuously try to failover. Use 0 to never failover. And use e.g. 3 to failover at most 3 times before giving up. This option can be used whether roundRobin is enabled or not.", 'string', '', '-1', false, false, false, false, '', ''), ], [ ]), - new ElementMeta('random', 'RandomLoadBalancerDefinition', 'Random', "The destination endpoints are selected randomly.", 'eip,routing', [ + new ElementMeta('randomLoadBalancer', 'RandomLoadBalancerDefinition', 'Random Load Balancer', "The destination endpoints are selected randomly.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), ], [ ]), - new ElementMeta('roundRobin', 'RoundRobinLoadBalancerDefinition', 'Round Robin', "The destination endpoints are selected in a round-robin fashion. This is a well-known and classic policy, which spreads the load evenly.", 'eip,routing', [ + new ElementMeta('roundRobinLoadBalancer', 'RoundRobinLoadBalancerDefinition', 'Round Robin Load Balancer', "The destination endpoints are selected in a round-robin fashion. This is a well-known and classic policy, which spreads the load evenly.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), ], [ ]), - new ElementMeta('sticky', 'StickyLoadBalancerDefinition', 'Sticky', "Sticky load balancing using an expression to calculate a correlation key to perform the sticky load balancing.", 'eip,routing', [ + new ElementMeta('stickyLoadBalancer', 'StickyLoadBalancerDefinition', 'Sticky Load Balancer', "Sticky load balancing using an expression to calculate a correlation key to perform the sticky load balancing.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('correlationExpression', 'Correlation Expression', "The correlation expression to use to calculate the correlation key", 'ExpressionSubElementDefinition', '', '', true, false, false, true, '', ''), ], [ ]), - new ElementMeta('topic', 'TopicLoadBalancerDefinition', 'Topic', "Topic which sends to all destinations.", 'eip,routing', [ + new ElementMeta('topicLoadBalancer', 'TopicLoadBalancerDefinition', 'Topic Load Balancer', "Topic which sends to all destinations.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), ], [ ]), - new ElementMeta('weighted', 'WeightedLoadBalancerDefinition', 'Weighted', "Uses a weighted load distribution ratio for each server with respect to others.", 'eip,routing', [ + new ElementMeta('weightedLoadBalancer', 'WeightedLoadBalancerDefinition', 'Weighted Load Balancer', "Uses a weighted load distribution ratio for each server with respect to others.", 'eip,routing', [ new PropertyMeta('id', 'Id', "The id of this node", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('distributionRatio', 'Distribution Ratio', "The distribution ratio is a delimited String consisting on integer weights separated by delimiters for example 2,3,5. The distributionRatio must match the number of endpoints and/or processors specified in the load balancer list.", 'string', '', '', true, false, false, false, '', ''), new PropertyMeta('distributionRatioDelimiter', 'Distribution Ratio Delimiter', "Delimiter used to specify the distribution ratio. The default value is , (comma)", 'string', '', ',', false, false, false, false, 'advanced', ''), @@ -2382,6 +2382,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), @@ -2405,6 +2406,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), @@ -2428,6 +2430,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), @@ -2486,6 +2489,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), @@ -2509,6 +2513,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), @@ -2532,6 +2537,7 @@ export const CamelModelMetadata: ElementMeta[] = [ new PropertyMeta('enableNoContentResponse', 'Enable No Content Response', "Whether to return HTTP 204 with an empty body when a response contains an empty JSON object or XML root object. The default value is false.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('apiDocs', 'Api Docs', "Whether to include or exclude this rest operation in API documentation. The default value is true.", 'boolean', '', 'true', false, false, false, false, 'advanced', ''), new PropertyMeta('deprecated', 'Deprecated', "Marks this rest operation as deprecated in OpenApi documentation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), + new PropertyMeta('streamCache', 'Stream Cache', "Whether stream caching is enabled on this rest operation.", 'boolean', '', 'false', false, false, false, false, 'advanced', ''), new PropertyMeta('routeId', 'Route Id', "Sets the id of the route", 'string', '', '', false, false, false, false, '', ''), new PropertyMeta('param', 'param', "param", 'ParamDefinition', '', '', false, false, true, true, '', ''), new PropertyMeta('responseMessage', 'responseMessage', "responseMessage", 'ResponseMessageDefinition', '', '', false, false, true, true, '', ''), diff --git a/karavan-core/src/core/model/ComponentModels.ts b/karavan-core/src/core/model/ComponentModels.ts index 3936ee94..2825f00f 100644 --- a/karavan-core/src/core/model/ComponentModels.ts +++ b/karavan-core/src/core/model/ComponentModels.ts @@ -37,11 +37,13 @@ export class ComponentTitle { producerOnly: boolean = false; lenientProperties: boolean = false; componentProperties: any; + remote: boolean = false; public constructor(init?: Partial<ComponentTitle>) { Object.assign(this, init); } } + export class ComponentHeader { name: string = ''; index: number = 0; diff --git a/karavan-generator/dependency-reduced-pom.xml b/karavan-generator/dependency-reduced-pom.xml index 9ed0c284..c1408608 100644 --- a/karavan-generator/dependency-reduced-pom.xml +++ b/karavan-generator/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.apache.camel.karavan</groupId> <artifactId>karavan-generator</artifactId> - <version>4.5.1</version> + <version>4.7.0</version> <build> <resources> <resource> @@ -68,7 +68,7 @@ <version.vertx>4.5.7</version.vertx> <surefire-plugin.version>3.0.0-M5</surefire-plugin.version> <maven.compiler.target>17</maven.compiler.target> - <version.camel-core>4.6.0</version.camel-core> + <version.camel-core>4.7.0</version.camel-core> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.parameters>true</maven.compiler.parameters> </properties> diff --git a/karavan-generator/pom.xml b/karavan-generator/pom.xml index ff57cfce..8b8dbebe 100644 --- a/karavan-generator/pom.xml +++ b/karavan-generator/pom.xml @@ -28,7 +28,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <surefire-plugin.version>3.0.0-M5</surefire-plugin.version> - <version.camel-core>4.6.0</version.camel-core> + <version.camel-core>4.7.0</version.camel-core> <version.camel-kamelet>4.6.0</version.camel-kamelet> <version.vertx>4.5.7</version.vertx> </properties> diff --git a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java index 8bbf8679..cc83d878 100644 --- a/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java +++ b/karavan-generator/src/main/java/org/apache/camel/karavan/generator/AbstractGenerator.java @@ -90,8 +90,6 @@ public class AbstractGenerator { className = "streamConfig"; } else if (className.equals("RestSecuritiesDefinition")) { className = "securityDefinitions"; - } else if (className.endsWith("LoadBalancerDefinition")) { - return getLoadBalancerDefinitionStepNameForClass(className); } else if (className.endsWith("Definition")) { className = className.substring(0, className.length() - 10); } else if (className.endsWith("DataFormat")) { @@ -102,15 +100,6 @@ public class AbstractGenerator { return deCapitalize(className); } - protected String getLoadBalancerDefinitionStepNameForClass(String className) { - if (Objects.equals("CustomLoadBalancerDefinition", className)) { - className = className.substring(0, className.length() - 10); - } else { - className = className.substring(0, className.length() - 22); - } - return deCapitalize(className); - } - protected Map<String, String> getDataFormatStepNameForClass() { Map<String, String> stepNames = new LinkedHashMap<>(); JsonObject definitions = getDefinitions();
