{
  "factory": {
    "id": "abstract-connector-in",
    "type": "entaxy.runtime.connector",
    "description": "Abstract IN-connector factory",
    "isAbstract": true,
    "parent": "abstract-connector"
  },
  "entaxy.runtime.connector": {
    "direction": "in",
    /* BOTH, EXCLUSIVE_ONLY, NON_EXCLUSIVE_ONLY */
    "exclusiveMode": "BOTH",
    "generation.plugins": ["config-support"]
  },
  "fields": {
  		"runExclusive": {
			"displayName": "Run Exclusive",
			"description": "Run only on one node of cluster. For more details see <a target=\"_blank\" href=\"https://camel-docs.entaxy.ru/components/${camel-docs.version}/master-component.html\">Camel docs</a>",
  			"type": "Boolean",
  			"immutable": true,
			"required": true,
  			"@VARIANTS": {
  				"property": "exclusiveMode",
  				"values": {
  					"BOTH": {
  						"defaultValue": false
  					},
  					"EXCLUSIVE_ONLY": {
  						"isHidden": true,
  						"fixedValue": true,
  						"defaultValue": true
  					},
  					"NON_EXCLUSIVE_ONLY": {
  						"isHidden": true,
  						"fixedValue": false,
  						"defaultValue": false
  					}
  				}
  			}
  		},
		"pre-route": {
			"displayName": "Pre-Route",
			"type": "xml:route",
			"required": true,
			"description": "Customize the message processing before further routing to the input flow of the profile.",
			"@RESOURCE": {
				"_provider": "entaxy-file-internal",
				"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
								}
							}
						}
					}
					
				],
		        "postprocess": [
				  {
				  	"processor": "component-library",
					"parameters": {
						"profileName": {				
							"@CALCULATED": {
								"expression": "${#OWNER#.properties.systemName}",
								"lazy": false
							}
						}
					}
				  }
				]				
			},
			"defaultValue": {
				"@RESOURCE": {
					"provider": "entaxy-file-internal",
					"location": "factories/abstract-connector-in/pre-route.xml",
					"endType": "String",
					"format": "base64"
				}
			},
			"config": {
				"scope": "public"
			}
		},
		"__legacy": {
			"type": "entaxy.runtime.connector",
			"isRef": true,
			"required": true,
			"isHidden": true,
			"isRefByValueOnly": true,
			"@INTERNAL": true,
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "legacy",
				"scope": "private",
				"properties": {
					"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
						}
					}
					
				}
			}
		},
		"__rootRoute": {
			"type": "entaxy.runtime.connector",
			"isRef": true,
			"required": true,
			"isHidden": true,
			"isRefByValueOnly": true,
			"@INTERNAL": true,
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "rootRoute",
				"scope": "private",
				"properties": {
					"connectorId": {
						"@CALCULATED": {
							"expression": "${#OWNER#.objectId}",
							"lazy": true
						}
					},
					"processResponse": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.processResponse}",
							"lazy": true,
							"resultType": "boolean"
						}
					},
					"profile": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.profile}",
							"lazy": true
						}						
					},
					"classifier": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.classifier}",
							"lazy": true
						}						
					},
					"defaultDestination": {
						"@CALCULATED": {
							"expression": "${#OWNER#.properties.defaultDestination}",
							"lazy": true,
							"allowObjects": false
						}
					}
				}
			}		
		},
		"__clusterService": {
			"type": "entaxy.runtime.connection",
			"isRef": true,
			"required": true,
			"isHidden": true,
			"@INTERNAL": true,
			"condition": "${runExclusive}",
			"defaultValue": {
				"type": "entaxy.runtime.connector",
				"factoryId": "#OWNER#",
				"outputType": "exclusiveSupport",
				"scope": "private",
				"properties": {
					"connectorId": {
						"@CALCULATED": {
							"expression": "${#OWNER#.objectId}",
							"lazy": true
						}
					},
					"fileStorage": {
						"type": "entaxy.runtime.connection",
						"isRef": true,
						"refField": "rootDirectory",
						"targetId": "entaxy-file-internal",
						"targetType": "entaxy.runtime.connection"
					}				
				}
			}
		},
		"exclusivePrefix": {
			"type": "String",
			"isHidden": true,
			"@INTERNAL": true,
			"condition": "${runExclusive}",
			"@INTERNAL": true,
			"required": true,
			"defaultValue": {
				"@CALCULATED": {
					"expression": "master:${objectId}:",
					"lazy": true
				}
			}
		},
		"objectId": {
			"isHidden": true
		},
		"defaultDestination": {
			"displayName": "Default target system",
			"description": "The name of the profile to which the message should be sent",
			"type": "String",
			"required": false,
			"group": "entaxy"
		},
		"generateLoggingKey": {
			"displayName": "Generate logging key",
			"description": "Enable to automatically create a logging key that will be used to track the request processing. (${exchangeProperty.requestId}, ${exchangeProperty.service}, ${exchangeProperty.operation}, ${exchangeProperty.objectId}, ${exchangeProperty.parameter}, ${exchangeProperty.sender}, ${exchangeProperty.receiver})",
			"type": "Boolean",
			"required": false,
			"group": "general",
			"defaultValue": true,
			"@UI": {
				"transmitAlways": true
			}
		}
  },
  "outputs": {
	    "init": {
	      "isDefault": true,
	      "fields": {
	      	"defaultDestination": {},
	      	"runExclusive": {},
	      	"pre-route": {},
	      	"__rootRoute": {},
	      	"__legacy": {},
	      	"__clusterService": {},
	      	"exclusivePrefix": {},
			"objectId": {},
			"generateLoggingKey": {}
	      },
			"config": {
				"configurable": false
			}			
	      
	    },
	    "legacy": {
	    	"fields": {
	    		"systemName": {
	    			"type": "String",
	    			"required": true
	    		},
	    		"classifier": {},
	    		"type": {
	    			"type": "String",
	    			"required": true
	    		},
	    		"protocol": {
	    			"type": "String",
	    			"required": true
	    		}
	    	},
	    	"scopes": ["private"],
			"config": {
				"configurable": false,
				"@SKIP_PUBLISH": {}
			}			
	    },
		"rootRoute": {
			"fields": {
				"defaultDestination": {},
				"classifier": {},
				"connectorId": {},
				"processResponse": {},
				"profile": {}
			},
			"scopes": ["private"],
			"config": {
				"@SKIP_PUBLISH": {},
				"configurable": false
			}			
		},
		"exclusiveSupport": {
			"fields": {
				"connectorId": {
					"type": "String"
				},
				"fileStorage": {
					"type": "String"
				}
			},
			"scopes": ["private", "public"],
			"config": {
				"@SKIP_PUBLISH": {},
				"configurable": false
			}			
		}
    
  }
}
