/*! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com
*
*******************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************/
package org.pentaho.di.sdk.samples.steps.demo;
import java.util.List;
import org.eclipse.swt.widgets.Shell;
import org.pentaho.di.core.CheckResult;
import org.pentaho.di.core.CheckResultInterface;
import org.pentaho.di.core.annotations.Step;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.exception.KettleStepException;
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.exception.KettleXMLException;
import org.pentaho.di.core.injection.Injection;
import org.pentaho.di.core.injection.InjectionSupported;
import org.pentaho.di.core.row.RowMetaInterface;
import org.pentaho.di.core.row.ValueMetaInterface;
import org.pentaho.di.core.row.value.ValueMetaString;
import org.pentaho.di.core.variables.VariableSpace;
import org.pentaho.di.core.xml.XMLHandler;
import org.pentaho.di.i18n.BaseMessages;
import org.pentaho.di.repository.ObjectId;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.step.BaseStepMeta;
import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepDialogInterface;
import org.pentaho.di.trans.step.StepInterface;
import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.trans.step.StepMetaInterface;
import org.pentaho.metastore.api.IMetaStore;
import org.w3c.dom.Node;
/**
* This class is part of the demo step plug-in implementation.
* It demonstrates the basics of developing a plug-in step for PDI.
*
* The demo step adds a new string field to the row stream and sets its
* value to "Hello World!". The user may select the name of the new field.
*
* This class is the implementation of StepMetaInterface.
* Classes implementing this interface need to:
*
* - keep track of the step settings
* - serialize step settings both to xml and a repository
* - provide new instances of objects implementing StepDialogInterface, StepInterface and StepDataInterface
* - report on how the step modifies the meta-data of the row-stream (row structure and field types)
* - perform a sanity-check on the settings provided by the user
*
*/
@Step(
id = "DemoStep",
name = "DemoStep.Name",
description = "DemoStep.TooltipDesc",
image = "org/pentaho/di/sdk/samples/steps/demo/resources/demo.svg",
categoryDescription = "i18n:org.pentaho.di.trans.step:BaseStep.Category.Transform",
i18nPackageName = "org.pentaho.di.sdk.samples.steps.demo",
documentationUrl = "DemoStep.DocumentationURL",
casesUrl = "DemoStep.CasesURL",
forumUrl = "DemoStep.ForumURL"
)
@InjectionSupported( localizationPrefix = "DemoStepMeta.Injection." )
public class DemoStepMeta extends BaseStepMeta implements StepMetaInterface {
/**
* The PKG member is used when looking up internationalized strings.
* The properties file with localized keys is expected to reside in
* {the package of the class specified}/messages/messages_{locale}.properties
*/
private static final Class<?> PKG = DemoStepMeta.class; // for i18n purposes
/**
* Stores the name of the field added to the row-stream.
*/
@Injection( name = "OUTPUT_FIELD" )
private String outputField;
/**
* Constructor should call super() to make sure the base class has a chance to initialize properly.
*/
public DemoStepMeta() {
super();
}
/**
* Called by Spoon to get a new instance of the SWT dialog for the step.
* A standard implementation passing the arguments to the constructor of the step dialog is recommended.
*
* @param shell an SWT Shell
* @param meta description of the step
* @param transMeta description of the the transformation
* @param name the name of the step
* @return new instance of a dialog for this step
*/
public StepDialogInterface getDialog( Shell shell, StepMetaInterface meta, TransMeta transMeta, String name ) {
return new DemoStepDialog( shell, meta, transMeta, name );
}
/**
* Called by PDI to get a new instance of the step implementation.
* A standard implementation passing the arguments to the constructor of the step class is recommended.
*
* @param stepMeta description of the step
* @param stepDataInterface instance of a step data class
* @param cnr copy number
* @param transMeta description of the transformation
* @param disp runtime implementation of the transformation
* @return the new instance of a step implementation
*/
public StepInterface getStep( StepMeta stepMeta, StepDataInterface stepDataInterface, int cnr, TransMeta transMeta,
Trans disp ) {
return new DemoStep( stepMeta, stepDataInterface, cnr, transMeta, disp );
}
/**
* Called by PDI to get a new instance of the step data class.
*/
public StepDataInterface getStepData() {
return new DemoStepData();
}
/**
* This method is called every time a new step is created and should allocate/set the step configuration
* to sensible defaults. The values set here will be used by Spoon when a new step is created.
*/
public void setDefault() {
setOutputField( "demo_field" );
}
/**
* Getter for the name of the field added by this step
* @return the name of the field added
*/
public String getOutputField() {
return outputField;
}
/**
* Setter for the name of the field added by this step
* @param outputField the name of the field added
*/
public void setOutputField( String outputField ) {
this.outputField = outputField;
}
/**
* This method is used when a step is duplicated in Spoon. It needs to return a deep copy of this
* step meta object. Be sure to create proper deep copies if the step configuration is stored in
* modifiable objects.
*
* See org.pentaho.di.trans.steps.rowgenerator.RowGeneratorMeta.clone() for an example on creating
* a deep copy.
*
* @return a deep copy of this
*/
public Object clone() {
Object retval = super.clone();
return retval;
}
/**
* This method is called by Spoon when a step needs to serialize its configuration to XML. The expected
* return value is an XML fragment consisting of one or more XML tags.
*
* Please use org.pentaho.di.core.xml.XMLHandler to conveniently generate the XML.
*
* @return a string containing the XML serialization of this step
*/
public String getXML() throws KettleValueException {
StringBuilder xml = new StringBuilder();
// only one field to serialize
xml.append( XMLHandler.addTagValue( "outputfield", outputField ) );
return xml.toString();
}
/**
* This method is called by PDI when a step needs to load its configuration from XML.
*
* Please use org.pentaho.di.core.xml.XMLHandler to conveniently read from the
* XML node passed in.
*
* @param stepnode the XML node containing the configuration
* @param databases the databases available in the transformation
* @param metaStore the
没有合适的资源?快使用搜索试试~ 我知道了~
kettle-sdk-plugin-assembly-8.3.0.0-371.zip

共81个文件
java:59个
xml:9个
ktr:4个

需积分: 50 503 浏览量
2020-08-06
22:06:21
上传
评论
收藏 557KB ZIP 举报
温馨提示
pdi-ce-8.3.0.0-371.zip-kettle8.3版本插件SDK包,适用于大数据ETL开发人员进行大数据抽取转换(清洗)加载的一款开源ETL工具,Pentaho DataIntegration,官方可扩展自定义插件模板
资源推荐
资源详情
资源评论













收起资源包目录


















































































































































































































共 81 条
- 1
资源评论


quentinschuman
- 粉丝: 5
- 资源: 11
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
