@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
recordFactoryconfigurationContext, 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.
|
setupcustomValidate, getSupportedDynamicPropertyDescriptor, getSupportedPropertyDescriptors, onPropertyModified, reloadScriptBody, reloadScriptFileabstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getProperty, getStateManager, init, initialize, isEnabledequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, toString, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitinitializegetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validate@OnEnabled public void onEnabled(ConfigurationContext context)
onEnabled in class AbstractScriptedControllerServicepublic RecordSetWriter createWriter(ComponentLog logger, RecordSchema schema, java.io.OutputStream out) throws SchemaNotFoundException, java.io.IOException
RecordSetWriterFactoryCreates a new RecordSetWriter that is capable of writing record contents to an OutputStream.
createWriter in interface RecordSetWriterFactorylogger - 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 InputStreamSchemaNotFoundExceptionprotected boolean reloadScript(java.lang.String scriptBody)
reloadScript in class AbstractScriptedControllerServicescriptBody - 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
RecordSetWriterFactoryReturns 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 RecordSetWriterFactoryvariables - 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