@EventDriven @SideEffectFree @SupportsBatching @InputRequirement(value=INPUT_REQUIRED) @Tags(value={"Unpack","un-merge","tar","zip","archive","flowfile-stream","flowfile-stream-v3"}) @CapabilityDescription(value="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") @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") @SeeAlso(value=MergeContent.class) public class UnpackContent extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
UnpackContent.FlowFileStreamUnpacker |
protected static class |
UnpackContent.PackageFormat |
private static class |
UnpackContent.TarUnpacker |
private static class |
UnpackContent.Unpacker |
private static class |
UnpackContent.ZipUnpacker |
Modifier and Type | Field and Description |
---|---|
static String |
AUTO_DETECT_FORMAT_NAME |
static PropertyDescriptor |
FILE_FILTER |
private Pattern |
fileFilter |
static String |
FLOWFILE_STREAM_FORMAT_V2_NAME |
static String |
FLOWFILE_STREAM_FORMAT_V3_NAME |
static String |
FLOWFILE_TAR_FORMAT_NAME |
static String |
FRAGMENT_COUNT |
static String |
FRAGMENT_ID |
static String |
FRAGMENT_INDEX |
static String |
OCTET_STREAM |
static PropertyDescriptor |
PACKAGING_FORMAT |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_ORIGINAL |
static Relationship |
REL_SUCCESS |
private Set<Relationship> |
relationships |
static String |
SEGMENT_ORIGINAL_FILENAME |
static String |
TAR_FORMAT_NAME |
private UnpackContent.Unpacker |
tarUnpacker |
static String |
ZIP_FORMAT_NAME |
private UnpackContent.Unpacker |
zipUnpacker |
Constructor and Description |
---|
UnpackContent() |
Modifier and Type | Method and Description |
---|---|
private void |
finishFragmentAttributes(ProcessSession session,
FlowFile source,
List<FlowFile> unpacked) |
Set<Relationship> |
getRelationships() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
private static void |
mapAttributes(Map<String,String> attributes,
String oldKey,
String newKey) |
void |
onScheduled(ProcessContext context) |
void |
onStopped() |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
customValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final String FRAGMENT_ID
public static final String FRAGMENT_INDEX
public static final String FRAGMENT_COUNT
public static final String SEGMENT_ORIGINAL_FILENAME
public static final String AUTO_DETECT_FORMAT_NAME
public static final String TAR_FORMAT_NAME
public static final String ZIP_FORMAT_NAME
public static final String FLOWFILE_STREAM_FORMAT_V3_NAME
public static final String FLOWFILE_STREAM_FORMAT_V2_NAME
public static final String FLOWFILE_TAR_FORMAT_NAME
public static final String OCTET_STREAM
public static final PropertyDescriptor PACKAGING_FORMAT
public static final PropertyDescriptor FILE_FILTER
public static final Relationship REL_SUCCESS
public static final Relationship REL_ORIGINAL
public static final Relationship REL_FAILURE
private Set<Relationship> relationships
private List<PropertyDescriptor> properties
private Pattern fileFilter
private UnpackContent.Unpacker tarUnpacker
private UnpackContent.Unpacker zipUnpacker
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
@OnStopped public void onStopped()
@OnScheduled public void onScheduled(ProcessContext context) throws ProcessException
ProcessException
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger
in class AbstractProcessor
ProcessException
private static void mapAttributes(Map<String,String> attributes, String oldKey, String newKey)
private void finishFragmentAttributes(ProcessSession session, FlowFile source, List<FlowFile> unpacked)
Copyright © 2017 Apache NiFi Project. All rights reserved.