@Tags(value={"record","writer","script","invoke","groovy","python","jython","jruby","ruby","javascript","js","lua","luaj","restricted"}) @CapabilityDescription(value="Allows the user to provide a scripted RecordSetWriterFactory instance in order to write records to an outgoing flow file.") @Restricted(value="Provides operator the ability to execute arbitrary code assuming all permissions that NiFi has.") public class ScriptedRecordSetWriter extends AbstractScriptedRecordFactory<RecordSetWriterFactory> implements RecordSetWriterFactory
recordFactory
configurationContext, scriptEngine, scriptingComponentHelper, scriptNeedsReload, validationResults
Constructor and Description |
---|
ScriptedRecordSetWriter() |
Modifier and Type | Method and Description |
---|---|
RecordSetWriter |
createWriter(ComponentLog logger,
RecordSchema schema,
java.io.OutputStream out)
Creates a new RecordSetWriter that is capable of writing record contents to an OutputStream.
|
RecordSchema |
getSchema(java.util.Map<java.lang.String,java.lang.String> variables,
RecordSchema readSchema)
Returns the Schema that will be used for writing Records.
|
void |
onEnabled(ConfigurationContext context) |
protected boolean |
reloadScript(java.lang.String scriptBody)
Reloads the script RecordSetWriterFactory.
|
setup
customValidate, getSupportedDynamicPropertyDescriptor, getSupportedPropertyDescriptors, onPropertyModified, reloadScriptBody, reloadScriptFile
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getProperty, getStateManager, init, initialize, isEnabled
equals, getPropertyDescriptor, getPropertyDescriptors, hashCode, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
initialize
getIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate
@OnEnabled public void onEnabled(ConfigurationContext context)
onEnabled
in class AbstractScriptedControllerService
public RecordSetWriter createWriter(ComponentLog logger, RecordSchema schema, java.io.OutputStream out) throws SchemaNotFoundException, java.io.IOException
RecordSetWriterFactory
Creates a new RecordSetWriter that is capable of writing record contents to an OutputStream.
createWriter
in interface RecordSetWriterFactory
logger
- the logger to use when logging information. This is passed in, rather than using the logger of the Controller Service
because it allows messages to be logged for the component that is calling this Controller Service.schema
- the schema that will be used for writing recordsout
- the OutputStream to write tojava.io.IOException
- if unable to read from the given InputStreamSchemaNotFoundException
protected boolean reloadScript(java.lang.String scriptBody)
reloadScript
in class AbstractScriptedControllerService
scriptBody
- An input stream associated with the script contentpublic RecordSchema getSchema(java.util.Map<java.lang.String,java.lang.String> variables, RecordSchema readSchema) throws SchemaNotFoundException, java.io.IOException
RecordSetWriterFactory
Returns the Schema that will be used for writing Records. The given variables are intended to be used for determining the schema that should be used when writing records.
getSchema
in interface RecordSetWriterFactory
variables
- the variables which is used to resolve Record Schema via Expression Language, can be null or emptyreadSchema
- the schema that was read from the incoming FlowFile, or null
if there is no input schemaSchemaNotFoundException
- if unable to find the schemajava.io.IOException