|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StepMetaInterface
This interface allows custom steps to talk to Kettle. The StepMetaInterface is the main Java interface that a plugin implements. The responsibilities of the implementing class are listed below:
The following interface methods also fall into the area of maintaining settings:
This method is called every time a new step is created and should allocate or set the step configuration to sensible defaults. The values set here will be used by Spoon when a new step is created. This is often a good place to ensure that the step’s settings are initialized to non-null values. Null values can be cumbersome to deal with in serialization and dialog population, so most PDI step implementations stick to non-null values for all step settings.
This method is called when a step is duplicated in Spoon. It needs to return a deep copy of this step meta object. It is essential that the implementing class creates proper deep copies if the step configuration is stored in modifiable objects, such as lists or custom helper objects. See org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta.clone() for an example on creating a deep copy.
This method is called by PDI whenever a step needs to serialize its settings to XML. It is called when saving a transformation in Spoon. The method returns an XML string, containing the serialized step settings. The string contains a series of XML tags, typically one tag per setting. The helper class org.pentaho.di.core.xml.XMLHandler is typically used to construct the XML string.
This method is called by PDI whenever a step needs to read its settings from XML. The XML node containing the step’s settings is passed in as an argument. Again, the helper class org.pentaho.di.core.xml.XMLHandler is typically used to conveniently read the step settings from the XML node.
This method is called by PDI whenever a step needs to save its settings to a PDI repository. The repository object passed in as the first argument provides a convenient set of methods for serializing step settings. The transformation id and step id passed in should be used by the step as identifiers when calling the repository serialization methods.
This method is called by PDI whenever a step needs to read its configuration from a PDI repository. The step id given in the arguments should be used as the identifier when using the repositories serialization methods.
public StepDialogInterface getDialog(...)
public StepInterface getStep(...)
public StepDataInterface getStepData()
Each of the above methods returns a new instance of the plugin class implementing StepDialogInterface, StepInterface and StepDataInterface.
Given a description of the input rows, the plugin needs to modify it to match the structure for its output fields. The implementation modifies the passed in RowMetaInterface object to reflect any changes to the row stream. Typically a step adds fields to the row structure, which is done by creating ValueMeta objects (PDI’s default implementation of ValueMetaInterface), and appending them to the RowMetaInterface object. The section Working with Fields goes into deeper detail on ValueMetaInterface.
Each step has the opportunity to validate its settings and verify that the configuration given by the user is reasonable. In addition to that a step typically checks if it is connected to preceding or following steps, if the nature of the step requires that kind of connection. An input step may expect to not have a preceding step for example. The check method passes in a list of check remarks that the method should append its validation results to. Spoon then displays the list of remarks collected from the steps, allowing the user to take corrective action in case of validation warnings or errors.
Method Summary | |
---|---|
void |
analyseImpact(List<DatabaseImpact> impact,
TransMeta transMeta,
StepMeta stepMeta,
RowMetaInterface prev,
String[] input,
String[] output,
RowMetaInterface info)
Each step must be able to report on the impact it has on a database, table field, etc. |
void |
cancelQueries()
Call this to cancel trailing database queries (too long running, etc) |
void |
check(List<CheckResultInterface> remarks,
TransMeta transMeta,
StepMeta stepMeta,
RowMetaInterface prev,
String[] input,
String[] output,
RowMetaInterface info)
Checks the settings of this step and puts the findings in a remarks List. |
Object |
clone()
Make an exact copy of this step, make sure to explicitly copy Collections etc. |
boolean |
excludeFromCopyDistributeVerification()
This method is added to exclude certain steps from copy/distribute checking. |
boolean |
excludeFromRowLayoutVerification()
This method is added to exclude certain steps from layout checking. |
String |
exportResources(VariableSpace space,
Map<String,ResourceDefinition> definitions,
ResourceNamingInterface resourceNamingInterface,
Repository repository)
|
String |
getDialogClassName()
Get the name of the class that implements the dialog for this job entry JobEntryBase provides a default |
void |
getFields(RowMetaInterface inputRowMeta,
String name,
RowMetaInterface[] info,
StepMeta nextStep,
VariableSpace space)
Get the fields that are emitted by this step |
List<StreamInterface> |
getOptionalStreams()
|
StepMeta |
getParentStepMeta()
|
RowMetaInterface |
getRequiredFields(VariableSpace space)
The natural way of data flow in a transformation is source-to-target. |
List<ResourceReference> |
getResourceDependencies(TransMeta transMeta,
StepMeta stepMeta)
Get a list of all the resource dependencies that the step is depending on. |
SQLStatement |
getSQLStatements(TransMeta transMeta,
StepMeta stepMeta,
RowMetaInterface prev)
Standard method to return an SQLStatement object with SQL statements that the step needs in order to work correctly. |
StepInterface |
getStep(StepMeta stepMeta,
StepDataInterface stepDataInterface,
int copyNr,
TransMeta transMeta,
Trans trans)
Get the executing step, needed by Trans to launch a step. |
StepDataInterface |
getStepData()
Get a new instance of the appropriate data class. |
StepIOMetaInterface |
getStepIOMeta()
Returns the Input/Output metadata for this step. |
StepMetaInjectionInterface |
getStepMetaInjectionInterface()
|
TransMeta.TransformationType[] |
getSupportedTransformationTypes()
|
RowMetaInterface |
getTableFields()
|
Map<String,String> |
getUsedArguments()
Default a step doesn't use any arguments. |
DatabaseMeta[] |
getUsedDatabaseConnections()
This method returns all the database connections that are used by the step. |
String[] |
getUsedLibraries()
|
String |
getXML()
Get the XML that represents the values in this step |
void |
handleStreamSelection(StreamInterface stream)
When an optional stream is selected, this method is called to handled the ETL metadata implications of that. |
boolean |
hasRepositoryReferences()
|
void |
loadXML(Node stepnode,
List<DatabaseMeta> databases,
Map<String,Counter> counters)
Load the values for this step from an XML Node |
void |
lookupRepositoryReferences(Repository repository)
Look up the references after import |
void |
readRep(Repository rep,
ObjectId id_step,
List<DatabaseMeta> databases,
Map<String,Counter> counters)
Read the steps information from a Kettle repository |
void |
resetStepIoMeta()
For steps that handle dynamic input (info) or output (target) streams, it is useful to be able to force the recreate the StepIoMeta definition. |
void |
saveRep(Repository rep,
ObjectId id_transformation,
ObjectId id_step)
Save the steps data into a Kettle repository |
void |
searchInfoAndTargetSteps(List<StepMeta> steps)
Change step names into step objects to allow them to be name-changed etc. |
void |
setDefault()
Set default values |
void |
setParentStepMeta(StepMeta parentStepMeta)
Provide original lineage for this metadata object |
boolean |
supportsErrorHandling()
|
Method Detail |
---|
void setDefault()
void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
inputRowMeta
- The fields that are entering the step. These are changed to reflect the output metadata.name
- The name of the step to be used as origininfo
- The input rows metadata that enters the step through the specified channels in the same order as in method getInfoSteps(). The step metadata can then choose what to do with it: ignore it or not.
Interesting is also that in case of database lookups, the layout of the target database table is put in info[0]nextStep
- if this is a non-null value, it's the next step in the transformation. The one who's asking, the step where the data is targetted towards.space
- TODO
KettleStepException
- when an error occurred searching for the fields.String getXML() throws KettleException
KettleException
- in case there is a conversion or XML encoding errorvoid loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String,Counter> counters) throws KettleXMLException
stepnode
- the Node to get the info fromdatabases
- The available list of databases to reference tocounters
- Counters to reference.
KettleXMLException
- When an unexpected XML error occurred. (malformed etc.)void saveRep(Repository rep, ObjectId id_transformation, ObjectId id_step) throws KettleException
rep
- The Kettle repository to save toid_transformation
- The transformation IDid_step
- The step ID
KettleException
- When an unexpected error occurred (database, network, etc)void readRep(Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String,Counter> counters) throws KettleException
rep
- The repository to read fromid_step
- The step IDdatabases
- The databases to referencecounters
- The counters to reference
KettleException
- When an unexpected error occurred (database, network, etc)void check(List<CheckResultInterface> remarks, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info)
remarks
- The list to put the remarks in @see org.pentaho.di.core.CheckResultstepMeta
- The stepMeta to help checkingprev
- The fields coming from the previous stepinput
- The input step namesoutput
- The output step namesinfo
- The fields that are used as information by the stepObject clone()
RowMetaInterface getTableFields()
boolean excludeFromRowLayoutVerification()
boolean excludeFromCopyDistributeVerification()
String getDialogClassName()
StepInterface getStep(StepMeta stepMeta, StepDataInterface stepDataInterface, int copyNr, TransMeta transMeta, Trans trans)
stepMeta
- The step infostepDataInterface
- the step data interface linked to this step. Here the step can store temporary data, database connections, etc.copyNr
- The copy nr to gettransMeta
- The transformation infotrans
- The launching transformationStepDataInterface getStepData()
void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info) throws KettleStepException
impact
- The list of impacts @see org.pentaho.di.transMeta.DatabaseImpacttransMeta
- The transformation informationstepMeta
- The step informationprev
- The fields entering this stepinput
- The previous step namesoutput
- The output step namesinfo
- The fields used as information by this step
KettleStepException
SQLStatement getSQLStatements(TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev) throws KettleStepException
transMeta
- TransInfo object containing the complete transformationstepMeta
- StepMeta object containing the complete stepprev
- Row containing meta-data for the input fields (no data)
KettleStepException
void cancelQueries() throws KettleDatabaseException
KettleDatabaseException
Map<String,String> getUsedArguments()
RowMetaInterface getRequiredFields(VariableSpace space) throws KettleException
space
- the variable space to reference
KettleException
- in case the required fields can't be determined.DatabaseMeta[] getUsedDatabaseConnections()
String[] getUsedLibraries()
boolean supportsErrorHandling()
List<ResourceReference> getResourceDependencies(TransMeta transMeta, StepMeta stepMeta)
transMeta
- stepMeta
-
String exportResources(VariableSpace space, Map<String,ResourceDefinition> definitions, ResourceNamingInterface resourceNamingInterface, Repository repository) throws KettleException
space
- the variable space to usedefinitions
- resourceNamingInterface
- repository
- The repository to optionally load other resources from (to be converted to XML)
KettleException
StepMeta getParentStepMeta()
void setParentStepMeta(StepMeta parentStepMeta)
parentStepMeta
- the parent step metadata container objectStepIOMetaInterface getStepIOMeta()
List<StreamInterface> getOptionalStreams()
void handleStreamSelection(StreamInterface stream)
stream
- The optional stream to handle.void resetStepIoMeta()
void searchInfoAndTargetSteps(List<StepMeta> steps)
steps
- the steps to referenceStepMetaInjectionInterface getStepMetaInjectionInterface()
TransMeta.TransformationType[] getSupportedTransformationTypes()
boolean hasRepositoryReferences()
void lookupRepositoryReferences(Repository repository) throws KettleException
repository
- the repository to reference.
KettleException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |