{
  "factory": {
    "id": "abstract-connector",
    "type": "entaxy.runtime.connector",
    "description": "Abstract connector factory",
    "isAbstract": true,
	"parent": "abstract-route-container-object"
  },
  "entaxy.runtime.connector": {
  	"type": "unknown",
  	"protocol": "unknown",
  	/* BOTH, SYNC_ONLY, ASYNC_ONLY */
  	"syncMode": "ASYNC_ONLY"
  },
  "fields": {
	  "__entaxyContainerId": {
		  "type": "String",
		  "isHidden": true
	  },
	  "profile": {
		  "type": "String",
		  "required": true,
		  "isHidden": true,
		  "defaultValue": {
			  "@CALCULATED": {
				  "expression": "${properties.__entaxyContainerId}",
				  "lazy": false
			  }
		  }
	  },
		"__objectId": {
			"type": "String",
			"required": true,
			"isHidden": true,
			"defaultValue": {
				"@CALCULATED": {
					"expression": "${properties.profile}.${factoryId}.${properties.classifier}",
					"targetPath": "$.objectId",
					"removeResolved": true,
					"lazy": false
				}
			}
		},
		"classifier": {
			"displayName": "Classifier",
			"type": "String",
			"required": true,
			"immutable": true,
			"defaultValue": "main",
			"description": "Classifier of the connector. Must be unique for each connector of the same direction in the owning system",
			"@UNIQUE": {
				"filterProperties": ["direction"]
			},
			"@TYPEINFO": {
				"validation": {
					"rules": {
						"content": {
							"regex": "^[a-zA-Z][a-zA-Z0-9-]*$",
							"errorMessage": "Value can contain only latin letters, numbers and hyphen and should start with a letter"
						}
					}
				}
			}
		},
	    "displayName": {
			"type": "String",
			"required": true,
			"defaultValue": {
				"@CALCULATED": {
					"expression": "${objectId}",
					"lazy": true
				}
			}
		},
		"processResponse": {
			"displayName": "Process response",
			"description": "Enables the response processing before further routing to the sending system.",
			"type": "Boolean",
			"required": true,
			"group": "response",
			"defaultValue": false
		},
		"responseRoute": {
			"displayName": "Response route",
			"type": "xml:route",
			"required": true,
			"description": "Customize the response processing before further routing to the sending system.",
			"group": "response",
			"@RESOURCE": {
				"endType": "String",
				"format": "base64",
				"postprocess_bak":[
					{
						"processor": "xslt",
						"source":"entaxy-file-internal:routes-common/common-components.xslt",
						"parameters": {
							"profileName": {				
								"@CALCULATED": {
									"expression": "${#OWNER#.properties.systemName}",
									"lazy": false
								}
							},
							"connectorId": {
								"@CALCULATED": {
									"expression": "${#OWNER#.objectId}",
									"lazy": false
								}
							}
						}
					},
					{
						"processor": "xslt",
						"source":"entaxy-file-internal:routes-common/connector-commons.xslt",
						"parameters": {
							"profileName": {				
								"@CALCULATED": {
									"expression": "${#OWNER#.properties.systemName}",
									"lazy": false
								}
							},
							"connectorId": {
								"@CALCULATED": {
									"expression": "${#OWNER#.objectId}",
									"lazy": false
								}
							}
						}
					}
					
				],
		        "postprocess": [
				  {
				  	"processor": "component-library",
					"parameters": {
						"profileName": {				
							"@CALCULATED": {
								"expression": "${#OWNER#.properties.systemName}",
								"lazy": false
							}
						}
					}
				  }
				]
			},
			"defaultValue": {
				"@RESOURCE": {
					"provider": "entaxy-file-internal",
					"location": "factories/abstract-connector/response-route.xml",
					"endType": "String",
					"format": "base64"
				}
			},
			"config": {
				"scope": "public"
			},
			"@UI": {
				"managedBy": "processResponse"
			}
		},
		"__meta": {
			"type": "entaxy.runtime.connector",
			"isRef": true,
			"required": true,
			"isHidden": true,
			"isRefByValueOnly": true,
			"@INTERNAL": true,
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "meta",
				"scope": "private",
				"properties": {
					"prefixClassifier": "SOURCE",
					"connectorId": {
						"@CALCULATED": {
							"expression": "${#OWNER#.objectId}",
							"lazy": true
						}
					},
					"profile": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.profile}",
							"lazy": true
						}
					},
					"connectorProperties": {
						"@CALCULATED": {
							"expression": "${#OWNER#.#FACTORY#.#TYPEINFO#}",
							"resultType": "list_or_single",
							"lazy": false
						}
					},
					"connectorInstanceProperties": {
						"profile": {
							"@CALCULATED": {
								"expression": "${#OWNER#.properties.profile}",
								"lazy": true
							}						
						},
						"classifier": {
							"@CALCULATED": {
								"expression": "${#OWNER#.properties.classifier}",
								"lazy": true
							}						
						}/*,
						"type": {
							"@CALCULATED": {
								"expression": "${#OWNER#.factoryId}",
								"lazy": true
							}						
						}*/
					}
				}
			}
		},
		"__globalOptions": {
			"type": "entaxy.runtime.connector",
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "globalOptions",
				"scope": "private",
				"properties": {
					"__direction": {
						"@CALCULATED": {
							"expression": "${#FACTORY#.#TYPEINFO#.direction}",
							"lazy": false
						}
					},
					"connectorId": {
						"@CALCULATED": {
							"expression": "${#OWNER#.objectId}",
							"lazy": true
						}
					},
					"systemName": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.profile}",
							"lazy": false,
							"allowObjects": false
						}
					},
					"type": {
						"@CALCULATED": {
							"expression": "${#OWNER#.#FACTORY#.#TYPEINFO#.type}",
							"lazy": false
						}
					},
					"classifier": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.classifier}",
							"lazy": false
						}
					},
					"protocol": {
						"@CALCULATED": {
							"expression": "${#OWNER#.#FACTORY#.#TYPEINFO#.protocol}",
							"lazy": false
						}
					}
				}
			}
		},
		"___errorHandler": {
			"type": "entaxy.runtime.connector",
			"isRef": true,
			"required": true,
			"isHidden": true,
			"isRefByValueOnly": true,
			"@INTERNAL": true,
			"refConfig": {
				"@INTERNAL": true
			},
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "errorHandler",
				"scope": "private",
				"properties": {
					"errorHandlerType": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.errorHandlerType}",
							"lazy": false
						}
					},
					"deadLetterUri": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.deadLetterUri}",
							"lazy": false
						}
					},
					"maximumRedeliveries": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.maximumRedeliveries}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"redeliveryDelay": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.redeliveryDelay}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"asyncDelayedRedelivery": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.asyncDelayedRedelivery}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"backOffMultiplier": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.backOffMultiplier}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"useExponentialBackOff": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.useExponentialBackOff}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"collisionAvoidanceFactor": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.collisionAvoidanceFactor}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"useCollisionAvoidance": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.useCollisionAvoidance}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"maximumRedeliveryDelay": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.maximumRedeliveryDelay}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"retriesExhaustedLogLevel": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.retriesExhaustedLogLevel}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"retryAttemptedLogLevel": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.retryAttemptedLogLevel}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"retryAttemptedLogInterval": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.retryAttemptedLogInterval}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logRetryAttempted": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logRetryAttempted}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logStackTrace": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logStackTrace}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logRetryStackTrace": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logRetryStackTrace}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logHandled": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logHandled}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logNewException": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logNewException}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logContinued": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logContinued}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logExhausted": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logExhausted}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logExhaustedMessageHistory": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logExhaustedMessageHistory}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"logExhaustedMessageBody": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.logExhaustedMessageBody}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"disableRedelivery": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.disableRedelivery}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"delayPattern": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.delayPattern}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"allowRedeliveryWhileStopping": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.allowRedeliveryWhileStopping}",
							"fallbackObject": null,
							"lazy": false
						}
					},
					"exchangeFormatterRef": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.exchangeFormatterRef}",
							"fallbackObject": null,
							"lazy": false
						}
					}
				}
			}
		},
		"errorHandlerType": {
			"displayName": "Error Handler",
			"description": "The type of the error handler. Default value: DefaultErrorHandler",
			"type": "String",
			"@TYPEINFO": {
				"type": "enum",
				"values": [
					"DefaultErrorHandler",
					"DeadLetterChannel",
					"NoErrorHandler"
				]
			},
			"defaultValue": "DefaultErrorHandler",
			"required": true,
			"group": "redelivery policy"
		},
		"deadLetterUri": {
			"displayName": "Dead Letter URI",
			"description": "The dead letter endpoint uri for the Dead Letter error handler.",
			"type": "String",
			"defaultValue": "log:myLog",
			"required": true,
			"group": "redelivery policy"
		},
		"@IMPORT": [{
			"sourceFactoryId": "redelivery-policy",
			"location": "fields",
			"prefix": ""
		}],
		"##publish": {
			"type": "Map",
			"required": true,
			"isHidden": true,
			"defaultValue":{
				"bundleName": {
					"@CALCULATED": {
						"expression": "${objectId}",
						"lazy": true
					}
				},
				"system": {
					"@CALCULATED": {
						"expression": "${properties.profile}",
						"lazy": false,
						"allowObjects": false
					}
				},
				"classifier": {
					"@CALCULATED": {
						"expression": "${properties.classifier}",
						"lazy": false
					}
				},
				"protocol": {
					"@CALCULATED": {
						"expression": "${#FACTORY#.#TYPEINFO#.protocol}",
						"lazy": false
					}
				},
				"direction": {
					"@CALCULATED": {
						"expression": "${#FACTORY#.#TYPEINFO#.direction}",
						"lazy": false
					}
				},
				"displayName": {
					"@CALCULATED": {
						"expression": "${properties.displayName}",
						"lazy": true
					}
				},
				"relation": [
					{
						"@CALCULATED": {
							"expression": "${properties.profile}:entaxy.runtime.profile:connector:-aggregation:connectors/${#FACTORY#.#TYPEINFO#.direction}",
							"lazy": false
						}
					}
				]
			}
		}
  },
  "outputs": {
    "init": {
      "isDefault": true,
      "fields": {
        "__entaxyContainerId": {},
      	"__objectId": {},
      	"__meta": {},
		"__globalOptions": {},
        "__errorHandler": {},
        "errorHandlerType": {},
        "deadLetterUri": {},
        "@IMPORT": [{
            "sourceFactoryId": "redelivery-policy",
            "location": "fields",
            "prefix": ""
        }],
      	"classifier": {},
        "displayName": {},
      	"profile": {},
      	"processResponse": {},
      	"responseRoute": {},
      	"##publish": {}
      },
		"config": {
			"configurable": false
		}			
      
    },
	"__globalOptions": {
		"fields": {
			"__direction": {
				"type": "String",
				"required": true
			},
			"systemName": {
				"type": "String",
				"required": true
			},
			"classifier": {},
			"type": {
				"type": "String",
				"required": true
			},
			"protocol": {
				"type": "String",
				"required": true
			}
		},
		"scopes": ["private"],
		"config": {
			"@SKIP_PUBLISH": {},
			"configurable": false
		}
	},
	"__errorHandler": {
		"fields": {},
		"scopes": ["private"],
		"config": {
			"@SKIP_PUBLISH": {},
			"configurable": false
		}
	},
		"meta": {
			"fields": {
				"connectorProperties": {
					"required": true,
					"type": "Map"
				},
				"connectorId": {
					"type": "String"
				},
				"profile": {}
			},
			"scopes": ["private", "public"],
			"config": {
				"@SKIP_PUBLISH": {},
				"configurable": false
			}			
		}
    
  }
}
