Building Reusable Pipeline Components Part 4: Build SourceFileName Component

The Build SourceFileName component builds a value for the %SourceFileName% macro that can be used as part of a Send Port Url thus allowing customization of the file names.

The following class diagram shows the classes for the BuildSourceFileName component:

BuildSourceFileName classes

The BuildSourceFileName class derives from the PipelineComponentWithResourceBase base class and passes a name prefix and an instance to a ResourceManager to its constructor. The override of the ExecuteInternal method concatenates all the literal or context property values into one string and uses the FileAdapterMessageContext class to set the FILE.ReceivedFileName context property of the message. This context property is used as a value for the %SourceFileName% macro.

Both the Load and Save methods are overridden to manage persistence of the configured properties. Three values are maintained for each configured property (Key, Namespace and IsLiteral) and an extra count value to indicate the number of configured properties.

The BuildSourceFileNameBagNames utility class manages the names for each configured property in the persistence bag.

 Download the source code here.