@EventDriven @SideEffectFree @SupportsBatching @Tags(value={"XML","evaluate","XPath","XQuery"}) @InputRequirement(value=INPUT_REQUIRED) @CapabilityDescription(value="Evaluates one or more XQueries against the content of a FlowFile. The results of those XQueries are assigned to FlowFile Attributes or are written to the content of the FlowFile itself, depending on configuration of the Processor. XQueries are entered by adding user-defined properties; the name of the property maps to the Attribute Name into which the result will be placed (if the Destination is \'flowfile-attribute\'; otherwise, the property name is ignored). The value of the property must be a valid XQuery. If the XQuery returns more than one result, new attributes or FlowFiles (for Destinations of \'flowfile-attribute\' or \'flowfile-content\' respectively) will be created for each result (attributes will have a \'.n\' one-up number appended to the specified attribute name). If any provided XQuery returns a result, the FlowFile(s) will be routed to \'matched\'. If no provided XQuery returns a result, the FlowFile will be routed to \'unmatched\'. If the Destination is \'flowfile-attribute\' and the XQueries matche nothing, no attributes will be applied to the FlowFile.") @WritesAttribute(attribute="user-defined", description="This processor adds user-defined attributes if the <Destination> property is set to flowfile-attribute .") @DynamicProperty(name="A FlowFile attribute(if <Destination> is set to \'flowfile-attribute\'", value="An XQuery", description="If <Destination>=\'flowfile-attribute\' then the FlowFile attribute is set to the result of the XQuery. If <Destination>=\'flowfile-content\' then the FlowFile content is set to the result of the XQuery.") @SystemResourceConsiderations(value=@SystemResourceConsideration(resource=MEMORY,description="Processing requires reading the entire FlowFile into memory")) public class EvaluateXQuery extends AbstractProcessor
Modifier and Type | Class and Description |
---|---|
private static class |
EvaluateXQuery.XQueryValidator |
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
DESTINATION |
static String |
DESTINATION_ATTRIBUTE |
static String |
DESTINATION_CONTENT |
static String |
OUTPUT_METHOD_HTML |
static String |
OUTPUT_METHOD_TEXT |
static String |
OUTPUT_METHOD_XML |
private List<PropertyDescriptor> |
properties |
static Relationship |
REL_FAILURE |
static Relationship |
REL_MATCH |
static Relationship |
REL_NO_MATCH |
private Set<Relationship> |
relationships |
static PropertyDescriptor |
VALIDATE_DTD |
static PropertyDescriptor |
XML_OUTPUT_INDENT |
static PropertyDescriptor |
XML_OUTPUT_METHOD |
static PropertyDescriptor |
XML_OUTPUT_OMIT_XML_DECLARATION |
Constructor and Description |
---|
EvaluateXQuery() |
Modifier and Type | Method and Description |
---|---|
protected Collection<ValidationResult> |
customValidate(ValidationContext context) |
private String |
formatItem(net.sf.saxon.s9api.XdmItem item,
ProcessContext context) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected void |
init(ProcessorInitializationContext context) |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
(package private) void |
writeFormattedItem(net.sf.saxon.s9api.XdmItem item,
ProcessContext context,
OutputStream out) |
onTrigger
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrue
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isStateful
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final String DESTINATION_ATTRIBUTE
public static final String DESTINATION_CONTENT
public static final String OUTPUT_METHOD_XML
public static final String OUTPUT_METHOD_HTML
public static final String OUTPUT_METHOD_TEXT
public static final PropertyDescriptor DESTINATION
public static final PropertyDescriptor XML_OUTPUT_METHOD
public static final PropertyDescriptor XML_OUTPUT_OMIT_XML_DECLARATION
public static final PropertyDescriptor XML_OUTPUT_INDENT
public static final PropertyDescriptor VALIDATE_DTD
public static final Relationship REL_MATCH
public static final Relationship REL_NO_MATCH
public static final Relationship REL_FAILURE
private Set<Relationship> relationships
private List<PropertyDescriptor> properties
protected void init(ProcessorInitializationContext context)
init
in class AbstractSessionFactoryProcessor
protected Collection<ValidationResult> customValidate(ValidationContext context)
customValidate
in class AbstractConfigurableComponent
public Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
public void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor
private String formatItem(net.sf.saxon.s9api.XdmItem item, ProcessContext context) throws IOException
IOException
void writeFormattedItem(net.sf.saxon.s9api.XdmItem item, ProcessContext context, OutputStream out) throws IOException
IOException
Copyright © 2022 Apache NiFi Project. All rights reserved.