默认kettle保存文件是在本地文件系统。其他可选HDFS等
Docker部署KettleWeb
# 拉取镜像
docker pull hiromuhota/webspoon
# 启动镜像
docker run -d --name kettle-web -p 8080:8080 hiromuhota/webspoon
# 测试访问
http://localhost:8080/spoon/spoon
#配置中文化(root权限)
docker exec -it -u 0 kettle-web /bin/bash
# 清空/etc/apt/sources.list文件
echo > /etc/apt/sources.list
echo -e "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib \ndeb http://mirrors.aliyun.com/debian-security stretch/updates main \ndeb-src http://mirrors.aliyun.com/debian-security stretch/updates main \ndeb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib \ndeb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib \ndeb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" > /etc/apt/sources.list
apt-get update
apt-get install -y libtinfo5 --allow-remove-essential
apt-get install -y vim
cd /usr/local/tomcat/bin
vim setenv.sh
# 汉化配置,在文件末尾追加这如下两项内容配置
CATALINA_OPTS="-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
JAVA_OPTS="-Duser.language=zh -Duser.region=CN -Dfile.encoding=UTF-8"
docker restart kettle-web
Spoon.java部分源码
#Spoon.java部分源码
public boolean saveFileAs() throws KettleException {
try {
EngineMetaInterface meta = getActiveMeta();
if ( meta != null && AbstractMeta.class.isAssignableFrom( meta.getClass() ) ) {
if ( ( (AbstractMeta) meta ).hasMissingPlugins() ) {
MessageBox mb = new MessageBox( shell, SWT.OK | SWT.ICON_ERROR );
mb.setMessage( BaseMessages.getString( PKG, "Spoon.ErrorDialog.MissingPlugin.Error" ) );
mb.setText( BaseMessages.getString( PKG, "Spoon.ErrorDialog.MissingPlugin.Title" ) );
mb.open();
return false;
}
}
if ( meta != null ) {
if ( meta.canSave() ) {
return saveFileAs( meta );
}
}
} catch ( Exception e ) {
KettleRepositoryLostException krle = KettleRepositoryLostException.lookupStackStrace( e );
if ( krle != null ) {
new ErrorDialog( shell,
BaseMessages.getString( PKG, "Spoon.File.Save.Fail.Title" ),
krle.getPrefaceMessage(),
krle );
closeRepository();
} else {
new ErrorDialog( shell,
BaseMessages.getString( PKG, "Spoon.File.Save.Fail.Title" ),
BaseMessages.getString( PKG, "Spoon.File.Save.Fail.Message" ), e );
}
}
保存文件流程
另存或保存时都会先保存文件内容。
保存文件方式
作业后缀是*.kjb,转换后缀是*.ktr