public class StepExample extends StepAdapter
IStep
semantics.
This is an example implementation of
IStep
, through extension of the
StepAdapter
, that appends the
value of an input field to the string "Hello to "
and
places the result in a new field.
Note: The plugin examples are included in the Data Management Platform Java™ Plugin jar and as such have a package name that represents that location. Therefore, modifying the examples requires placing the modified source, including the package statement, in a new Java™ compilation unit.
mNumRowsRead, mParameterNames, mParameterValues, mStatus, mTimings, step
PREP_FLAG_FULL, PREP_FLAG_QUICK
Constructor and Description |
---|
StepExample()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
StepReadState |
next()
Retrieve the next row.
|
boolean |
preExec()
Prepare for execution.
|
PrepState |
prep(int flags)
Prepare input and output fields.
|
getNumRows, getParameterCount, getParameterName, getStatus, initialize, postExec, release, setParameterValue
public StepExample()
This example requires two parameters. To enable parameter processing by the
StepAdapter
the constructor must
create/populate mParameterNames
and mParameterValues
.
public StepReadState next()
IStep
Called when the next row is desired. The plugin should fetch the row and make it available via
PlugStep.getExistingOutputItems()
.
If the plugin has a parent, parent rows may be retrieved by
PlugStep.parentOutputItems()
.
next
in interface IStep
next
in class StepAdapter
StepReadState
that indicates the status of the row processing.
This must always be non-null.public boolean preExec()
IStep
Called when execution of the job is desired. The plugin is expected to prepare itself for execution.
Call PlugStep.getExecutionType
to determine the type of execution
desired. When this method is called, it is guaranteed that prep
has been called
with PREP_FLAG_FULL
on this and all parent steps.
The plugin should calculate the number of rows it expects to produce at this point, if possible.
preExec
in interface IStep
preExec
in class StepAdapter
true
on success, or false
on failure. If false
is returned,
the plugin should also indicate the error with PlugStep.setError
.public PrepState prep(int flags)
IStep
This will be called before preExec()
(unless no paramSet values have changed since the
last call). It will also be called when the user is requesting input names that a plugin requires or output
information that a plugin provides. The plugin is expected to build the output items with
PlugStep.buildOutputItems()
and build input names with
PlugStep.addInputName()
. Once this has been called
a single time, it will not be called again unless paramSet values have changed. This is called caching the preparedness.
If the plugin returns anything other than PrepState.ALL_SUCCESS
from this method, it
will not be cached, and will be called again the next time it is required. In addition, it will only be cached if it has
been called with PREP_FLAG_FULL
.
prep
in interface IStep
prep
in class StepAdapter
flags
- This will be PREP_FLAG_FULL
if the parent and all its
parents were successfully prepped. This is to allow prep to be called when one of the parents
failed to prep in the event the plugin is still able to get input names without the parent
being fully prepared.PrepState.ALL_SUCCESS
.
If everything failed, return PrepState.FAILED
. If partially
successful, return one of the other PrepState
values. This allows the DataFlow engine
to still process certain requests. If PrepState.FAILED
is returned, the
plugin should also indicate the error with PlugStep.setError
.Copyright © 2012 SAS Institute Inc. All Rights Reserved.