public interface ISimpleStep extends StepParameters
A Java? Plugin that has no need to interact directly with the Data Management Platform DataFlow interfaces in order to generate its output may implement this interface.
As is the case with IStep
based plugins, the Simple plugin
implementation may define and receive configuration parameters as name/value
pairs via the methods defined in the base StepParameters
interface.
A Simple plugin must comply with the following set of restrictions:
StepReadState.EOF
condtion to terminate input.
The primary reason to choose a Simple plugin over a fully featured
plugin implementing the IStep
interface is to minimize the amount
of code required to implement a Java? Plugin.
The ISimpleStep
methods are called in the following order:
getParameterCount()
setInputFieldCount()
validateInputs()
getOutputFieldCount()
preExec()
processRow()
postExec()
release()
Note: The SimpleStepAdapter
abstract class provides an extendable
implementation of the ISimpleStep
interface.
Modifier and Type | Method and Description |
---|---|
int |
getOutputFieldCount()
Return the number of output fields provided by this step.
|
FieldInformation |
getOutputFieldInformation(int index)
Return the information about an output field provided by this step.
|
java.lang.Object |
getOutputFieldValue(int index)
Return the value of an output field in the current row.
|
void |
postExec()
Execution of the job is complete.
|
void |
preExec(boolean previewMode)
Prepare for execution.
|
void |
processRow()
Process a row of data.
|
void |
release()
Release resources.
|
void |
setInputFieldCount(int count)
Set the number of fields provided by the parent step.
|
void |
setInputFieldInformation(int index,
java.lang.String name,
DataType type,
int length)
Set the input field information provided by the parent step.
|
void |
setInputFieldValue(int index,
java.lang.Object value)
Set the value of an input field.
|
void |
validateInputs()
Validate input field information.
|
getParameterCount, getParameterName, setParameterValue
void setInputFieldCount(int count)
count
- The number of fields provided by the parent step.void setInputFieldInformation(int index, java.lang.String name, DataType type, int length)
The Data Management Platform will always pass a index
that
is in bounds.
index
- The 0-based index of the input field.name
- The name of the input field.type
- The data type of the input field.length
- The maximum character length of the input field. This only
applies for string fields.void validateInputs() throws StepException
Called after all parameters are set and all input field information from the parent has been specified.
StepException
- If the inputs are not valid.int getOutputFieldCount()
If you want to "pass-through" any fields from the parent, you must include those fields in this count.
FieldInformation getOutputFieldInformation(int index) throws java.lang.IndexOutOfBoundsException
This method must return a valid instance of FieldInformation
.
index
- The 0-based index of the output field.java.lang.IndexOutOfBoundsException
- If the index argument is out of bounds.void preExec(boolean previewMode) throws StepException
Called after all parameters are set and all input fields from the parent have been specified, but before execution of the job begins. The plugin should prepare to accept input rows.
previewMode
- true
if the job is being previewed.StepException
- If anything goes wrong or the plugin cannot begin
to process rows.void setInputFieldValue(int index, java.lang.Object value)
The value being set is provided by the parent step.
The Data Management Platform will always pass a index
that
is in bounds.
index
- The 0-based index of the input field.value
- The value of the input field.void processRow() throws StepException
Called after all of the fields of an input row have been passed in. Process the row and make output fields available. Throw an exception to signal an error.
StepException
- If an error occurs during row processing.java.lang.Object getOutputFieldValue(int index) throws java.lang.IndexOutOfBoundsException
The Data Management Platform will always pass a index
that
is in bounds.
index
- The 0-based index of the output fieldnull
.java.lang.IndexOutOfBoundsException
- If the index argument is out of bounds.void postExec()
The plugin step should release any resources used during execution.
void release()
The plugin step should release any resources, such as file handles, here.
Called immediately before the plugin is released for garbage collection. This usually happens when the process running a job shuts down, although it can also happen when a node is deleted from a job.
Copyright © 2012 SAS Institute Inc. All Rights Reserved.