[#ftl attributes={"generated.type":"blueprint.fragment"}]
[#import "templates:object-commons/metadata-storage.ftl" as ms]           
	<!-- METADATA -->
	
	<!--
	
        [#if properties??]
        	[#list properties as key, value]
        Key: [=key]
        	[/#list]
        	[#if properties.connectorId??]
        connectorId: [=properties.connectorId]
        	[/#if]	
        [/#if]
	
		[#if properties.connectorInstanceProperties??]
		connectorInstanceProperties ::
        	[#list properties.connectorInstanceProperties as key, value]
        Key: [=key]; Value: [=value]
        	[/#list]
		[/#if]
	-->

	
	<reference id="[=properties.profile].metadataStorageRef" interface="ru.entaxy.platform.core.support.runtime.metadata.MetadataStorage"
           filter="(profile.name=[=properties.profile])"/>
			
	<bean id="[=properties.connectorId].metadataEnricher" class="ru.entaxy.platform.core.support.runtime.metadata.ExchangeEnricher" activation="eager">
	</bean>	
	
[#if properties.connectorProperties??]	
[@ms.metadata_storage id=properties.connectorId+".metadataStorage" data=properties.connectorProperties prefix="NTX_"+properties.prefixClassifier+"_connector_" consumer=properties.connectorId+".metadataEnricher" /]
[/#if]

[#if properties.connectorInstanceProperties??]
[@ms.metadata_storage id=properties.connectorId+".instanceMetadataStorage" data=properties.connectorInstanceProperties prefix="NTX_"+properties.prefixClassifier+"_connector_" consumer=properties.connectorId+".metadataEnricher" /]
[/#if]

	<bean id="[=properties.profile].metadataStorage" class="ru.entaxy.platform.core.support.runtime.metadata.MetadataStorageWrapper">
		<property name="origin" ref="[=properties.profile].metadataStorageRef" />
		<property name="prefix" value="NTX_[=properties.prefixClassifier!'NULL']_profile_" />
		<property name="consumer" ref="[=properties.connectorId].metadataEnricher" />
	</bean>
