@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.") public class EvaluateXQuery extends AbstractProcessor
Modifier and Type | Field and Description |
---|---|
static PropertyDescriptor |
DESTINATION |
static java.lang.String |
DESTINATION_ATTRIBUTE |
static java.lang.String |
DESTINATION_CONTENT |
static java.lang.String |
OUTPUT_METHOD_HTML |
static java.lang.String |
OUTPUT_METHOD_TEXT |
static java.lang.String |
OUTPUT_METHOD_XML |
static Relationship |
REL_FAILURE |
static Relationship |
REL_MATCH |
static Relationship |
REL_NO_MATCH |
static java.lang.String |
UTF8 |
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 java.util.Collection<ValidationResult> |
customValidate(ValidationContext context)
Allows subclasses to perform their own validation on the already set
properties.
|
java.util.Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(java.lang.String propertyDescriptorName)
Used to allow subclasses to determine what PropertyDescriptor if any to
use when a property is requested for which a descriptor is not already
registered.
|
protected java.util.List<PropertyDescriptor> |
getSupportedPropertyDescriptors()
Allows subclasses to register which property descriptor objects are
supported.
|
protected void |
init(ProcessorInitializationContext context)
Provides subclasses the ability to perform initialization logic
|
void |
onTrigger(ProcessContext context,
ProcessSession session) |
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
getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
public static final java.lang.String DESTINATION_ATTRIBUTE
public static final java.lang.String DESTINATION_CONTENT
public static final java.lang.String OUTPUT_METHOD_XML
public static final java.lang.String OUTPUT_METHOD_HTML
public static final java.lang.String OUTPUT_METHOD_TEXT
public static final java.lang.String UTF8
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
protected void init(ProcessorInitializationContext context)
AbstractSessionFactoryProcessor
init
in class AbstractSessionFactoryProcessor
context
- in which to perform initializationprotected java.util.Collection<ValidationResult> customValidate(ValidationContext context)
AbstractConfigurableComponent
customValidate
in class AbstractConfigurableComponent
context
- provides a mechanism for obtaining externally
managed values, such as property values and supplies convenience methods
for operating on those valuespublic java.util.Set<Relationship> getRelationships()
getRelationships
in interface Processor
getRelationships
in class AbstractSessionFactoryProcessor
protected java.util.List<PropertyDescriptor> getSupportedPropertyDescriptors()
AbstractConfigurableComponent
getSupportedPropertyDescriptors
in class AbstractConfigurableComponent
protected PropertyDescriptor getSupportedDynamicPropertyDescriptor(java.lang.String propertyDescriptorName)
AbstractConfigurableComponent
Used to allow subclasses to determine what PropertyDescriptor if any to use when a property is requested for which a descriptor is not already registered. By default this method simply returns a null descriptor. By overriding this method processor implementations can support dynamic properties since this allows them to register properties on demand. It is acceptable for a dynamically generated property to indicate it is required so long as it is understood it is only required once set. Dynamic properties by definition cannot be required until used.
This method should be side effect free in the subclasses in terms of how often it is called for a given property name because there is guarantees how often it will be called for a given property name.
Default is null.
getSupportedDynamicPropertyDescriptor
in class AbstractConfigurableComponent
propertyDescriptorName
- used to lookup if any property descriptors exist for that namepublic void onTrigger(ProcessContext context, ProcessSession session)
onTrigger
in class AbstractProcessor