Class UnpackContent

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.UnpackContent
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SideEffectFree @SupportsBatching @InputRequirement(INPUT_REQUIRED) @Tags({"Unpack","un-merge","tar","zip","archive","flowfile-stream","flowfile-stream-v3"}) @CapabilityDescription("Unpacks the content of FlowFiles that have been packaged with one of several different Packaging Formats, emitting one to many FlowFiles for each input FlowFile. Supported formats are TAR, ZIP, and FlowFile Stream packages.") @ReadsAttribute(attribute="mime.type", description="If the <Packaging Format> property is set to use mime.type attribute, this attribute is used to determine the FlowFile\'s MIME Type. In this case, if the attribute is set to application/tar, the TAR Packaging Format will be used. If the attribute is set to application/zip, the ZIP Packaging Format will be used. If the attribute is set to application/flowfile-v3 or application/flowfile-v2 or application/flowfile-v1, the appropriate FlowFile Packaging Format will be used. If this attribute is missing, the FlowFile will be routed to \'failure\'. Otherwise, if the attribute\'s value is not one of those mentioned above, the FlowFile will be routed to \'success\' without being unpacked. Use the File Filter property only extract files matching a specific regular expression.") @WritesAttribute(attribute="mime.type",description="If the FlowFile is successfully unpacked, its MIME Type is no longer known, so the mime.type attribute is set to application/octet-stream.") @WritesAttribute(attribute="fragment.identifier",description="All unpacked FlowFiles produced from the same parent FlowFile will have the same randomly generated UUID added for this attribute") @WritesAttribute(attribute="fragment.index",description="A one-up number that indicates the ordering of the unpacked FlowFiles that were created from a single parent FlowFile") @WritesAttribute(attribute="fragment.count",description="The number of unpacked FlowFiles generated from the parent FlowFile") @WritesAttribute(attribute="segment.original.filename ",description="The filename of the parent FlowFile. Extensions of .tar, .zip or .pkg are removed because the MergeContent processor automatically adds those extensions if it is used to rebuild the original FlowFile") @WritesAttribute(attribute="file.lastModifiedTime",description="The date and time that the unpacked file was last modified (tar and zip only).") @WritesAttribute(attribute="file.creationTime",description="The date and time that the file was created. For encrypted zip files this attribute always holds the same value as file.lastModifiedTime. For tar and unencrypted zip files if available it will be returned otherwise this will be the same value asfile.lastModifiedTime.") @WritesAttribute(attribute="file.lastMetadataChange",description="The date and time the file\'s metadata changed (tar only).") @WritesAttribute(attribute="file.lastAccessTime",description="The date and time the file was last accessed (tar and unencrypted zip files only)") @WritesAttribute(attribute="file.owner",description="The owner of the unpacked file (tar only)") @WritesAttribute(attribute="file.group",description="The group owner of the unpacked file (tar only)") @WritesAttribute(attribute="file.size",description="The uncompressed size of the unpacked file (tar and zip only)") @WritesAttribute(attribute="file.permissions",description="The read/write/execute permissions of the unpacked file (tar and unencrypted zip files only)") @WritesAttribute(attribute="file.encryptionMethod",description="The encryption method for entries in Zip archives") @SeeAlso(MergeContent.class) @UseCase(description="Unpack Zip containing filenames with special characters, created on Windows with filename charset \'Cp437\' or \'IBM437\'.", configuration="Set \"Packaging Format\" value to \"zip\" or \"use mime.type attribute\".\nSet \"Filename Character Set\" value to \"Cp437\" or \"IBM437\".\n") public class UnpackContent extends org.apache.nifi.processor.AbstractProcessor
  • Field Details

    • FRAGMENT_ID

      public static final String FRAGMENT_ID
    • FRAGMENT_INDEX

      public static final String FRAGMENT_INDEX
    • FRAGMENT_COUNT

      public static final String FRAGMENT_COUNT
    • SEGMENT_ORIGINAL_FILENAME

      public static final String SEGMENT_ORIGINAL_FILENAME
    • AUTO_DETECT_FORMAT_NAME

      public static final String AUTO_DETECT_FORMAT_NAME
      See Also:
    • TAR_FORMAT_NAME

      public static final String TAR_FORMAT_NAME
      See Also:
    • ZIP_FORMAT_NAME

      public static final String ZIP_FORMAT_NAME
      See Also:
    • FLOWFILE_STREAM_FORMAT_V3_NAME

      public static final String FLOWFILE_STREAM_FORMAT_V3_NAME
      See Also:
    • FLOWFILE_STREAM_FORMAT_V2_NAME

      public static final String FLOWFILE_STREAM_FORMAT_V2_NAME
      See Also:
    • FLOWFILE_TAR_FORMAT_NAME

      public static final String FLOWFILE_TAR_FORMAT_NAME
      See Also:
    • OCTET_STREAM

      public static final String OCTET_STREAM
      See Also:
    • FILE_LAST_MODIFIED_TIME_ATTRIBUTE

      public static final String FILE_LAST_MODIFIED_TIME_ATTRIBUTE
      See Also:
    • FILE_CREATION_TIME_ATTRIBUTE

      public static final String FILE_CREATION_TIME_ATTRIBUTE
      See Also:
    • FILE_LAST_METADATA_CHANGE_ATTRIBUTE

      public static final String FILE_LAST_METADATA_CHANGE_ATTRIBUTE
      See Also:
    • FILE_LAST_ACCESS_TIME_ATTRIBUTE

      public static final String FILE_LAST_ACCESS_TIME_ATTRIBUTE
      See Also:
    • FILE_OWNER_ATTRIBUTE

      public static final String FILE_OWNER_ATTRIBUTE
      See Also:
    • FILE_GROUP_ATTRIBUTE

      public static final String FILE_GROUP_ATTRIBUTE
      See Also:
    • FILE_SIZE_ATTRIBUTE

      public static final String FILE_SIZE_ATTRIBUTE
      See Also:
    • FILE_PERMISSIONS_ATTRIBUTE

      public static final String FILE_PERMISSIONS_ATTRIBUTE
      See Also:
    • FILE_ENCRYPTION_METHOD_ATTRIBUTE

      public static final String FILE_ENCRYPTION_METHOD_ATTRIBUTE
      See Also:
    • FILE_MODIFIED_DATE_ATTR_FORMAT

      public static final String FILE_MODIFIED_DATE_ATTR_FORMAT
      See Also:
    • DATE_TIME_FORMATTER

      public static final DateTimeFormatter DATE_TIME_FORMATTER
    • PACKAGING_FORMAT

      public static final org.apache.nifi.components.PropertyDescriptor PACKAGING_FORMAT
    • ZIP_FILENAME_CHARSET

      public static final org.apache.nifi.components.PropertyDescriptor ZIP_FILENAME_CHARSET
    • FILE_FILTER

      public static final org.apache.nifi.components.PropertyDescriptor FILE_FILTER
    • PASSWORD

      public static final org.apache.nifi.components.PropertyDescriptor PASSWORD
    • ALLOW_STORED_ENTRIES_WITH_DATA_DESCRIPTOR

      public static final org.apache.nifi.components.PropertyDescriptor ALLOW_STORED_ENTRIES_WITH_DATA_DESCRIPTOR
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • REL_ORIGINAL

      public static final org.apache.nifi.processor.Relationship REL_ORIGINAL
    • REL_FAILURE

      public static final org.apache.nifi.processor.Relationship REL_FAILURE
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • fileFilter

      private Pattern fileFilter
    • tarUnpacker

      private UnpackContent.Unpacker tarUnpacker
    • zipUnpacker

      private UnpackContent.Unpacker zipUnpacker
  • Constructor Details

    • UnpackContent

      public UnpackContent()
  • Method Details

    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • onStopped

      @OnStopped public void onStopped()
    • onScheduled

      @OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) throws org.apache.nifi.processor.exception.ProcessException
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session) throws org.apache.nifi.processor.exception.ProcessException
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
      Throws:
      org.apache.nifi.processor.exception.ProcessException
    • finishFragmentAttributes

      private void finishFragmentAttributes(org.apache.nifi.processor.ProcessSession session, org.apache.nifi.flowfile.FlowFile source, List<org.apache.nifi.flowfile.FlowFile> unpacked)