pentaho 4.8 添加 kettle 默认情况下只对数据库资源库的支持
对于文件资源库是不支持的。
与文件资源库相比,数据库资源库不利于开发与维护。
pentaho在国内的资料很少,社区不太活跃,其稍微深入的问题都没有现成的答案。。。
看源码,发现其代码里面没有添加对文件资源库的支持。
好在 pentaho 与 kettle 的核心源码都看过。。。小小改动下,还是让其能够支持文件资源库了。。。
修改
org.pentaho.platform.plugin.action.kettle.KettleComponent类
搜索
PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.type", "files").equals("rdbms");
发现有三处
验证系统设置
@Override protected boolean validateSystemSettings() { // set pentaho.solutionpath so that it can be used in file paths boolean useRepository = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.type", "files").equals("rdbms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (useRepository) { repositoriesXMLFile = PentahoSystem.getSystemSetting("kettle/settings.xml", "repositories.xml.file", null); //$NON-NLS-1$ //$NON-NLS-2$ repositoryName = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.name", null); //$NON-NLS-1$ //$NON-NLS-2$ username = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.userid", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ password = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.password", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // Check the Kettle settings... if ("".equals(repositoryName) || username.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ // looks like the Kettle stuff is not configured yet... // see if we can provide feedback to the user... error(Messages.getErrorString("Kettle.ERROR_0001_SERVER_SETTINGS_NOT_SET")); //$NON-NLS-1$ return false; } boolean ok = ((repositoryName != null) && (repositoryName.length() > 0)); ok = ok || ((username != null) && (username.length() > 0)); return ok; } else { repositoriesXMLFile = PentahoSystem.getSystemSetting("kettle/settings.xml", "repositories.xml.file", null); //$NON-NLS-1$ //$NON-NLS-2$ repositoryName = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.name", null); //$NON-NLS-1$ //$NON-NLS-2$ // Check the Kettle settings... if ("".equals(repositoryName)) { //$NON-NLS-1$ //$NON-NLS-2$ // looks like the Kettle stuff is not configured yet... // see if we can provide feedback to the user... error(Messages.getErrorString("Kettle.ERROR_0001_SERVER_SETTINGS_NOT_SET")); //$NON-NLS-1$ return false; } boolean ok = ((repositoryName != null) && (repositoryName.length() > 0)); return ok; } }
其验证Action,注释一部分如下
@SuppressWarnings("unchecked") @Override public boolean validateAction() { ... if (isDefinedResource(KettleComponent.TRANSFORMFILE) || isDefinedResource(KettleComponent.JOBFILE)) { return true; } /* boolean useRepository = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.type", "files").equals("rdbms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (!useRepository) { error(Messages.getErrorString("Kettle.ERROR_0019_REPOSITORY_TYPE_FILES")); //$NON-NLS-1$ return false; }*/ if (isDefinedInput(KettleComponent.DIRECTORY) && (isDefinedInput(KettleComponent.TRANSFORMATION) || isDefinedInput(KettleComponent.JOB))) { return true; } ... }
修改其连接资源库部分
private Repository connectToRepository(final LogWriter logWriter) { boolean useRepository = PentahoSystem.getSystemSetting("kettle/settings.xml", "repository.type", "files").equals("rdbms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if (!useRepository) { // if方法默认返回为空,这里添加对文件资源库的支持。 RepositoriesMeta repositoriesMeta = null; try { repositoriesMeta = new RepositoriesMeta(); } catch (Exception e) { error(Messages.getErrorString("Kettle.ERROR_0007_BAD_META_REPOSITORY"), e); //$NON-NLS-1$ return null; } if (ComponentBase.debug) { debug(Messages.getString("Kettle.DEBUG_POPULATING_META")); //$NON-NLS-1$ } try { // TODO: add support for specified repositories.xml files... repositoriesMeta.readData(); // Read from the default // $HOME/.kettle/repositories.xml // file. } catch (Exception e) { error(Messages.getErrorString("Kettle.ERROR_0018_META_REPOSITORY_NOT_POPULATED"), e); //$NON-NLS-1$ return null; } if (ComponentBase.debug) { debug(Messages.getString("Kettle.DEBUG_FINDING_REPOSITORY")); //$NON-NLS-1$ } // Find the specified repository. RepositoryMeta repositoryMeta = null; try { repositoryMeta = repositoriesMeta.findRepository(repositoryName); } catch (Exception e) { error(Messages.getErrorString("Kettle.ERROR_0004_REPOSITORY_NOT_FOUND", repositoryName), e); //$NON-NLS-1$ return null; } if (repositoryMeta == null) { error(Messages.getErrorString("Kettle.ERROR_0004_REPOSITORY_NOT_FOUND", repositoryName)); //$NON-NLS-1$ return null; } if (ComponentBase.debug) { debug(Messages.getString("Kettle.DEBUG_GETTING_REPOSITORY")); //$NON-NLS-1$ } Repository repository = null; try { repository = PluginRegistry.getInstance().loadClass(RepositoryPluginType.class, repositoryMeta.getId(), Repository.class); repository.init(repositoryMeta); } catch (Exception e) { error(Messages.getErrorString("Kettle.ERROR_0016_COULD_NOT_GET_REPOSITORY_INSTANCE"), e); //$NON-NLS-1$ return null; } // OK, now try the username and password if (ComponentBase.debug) { debug(Messages.getString("Kettle.DEBUG_CONNECTING")); //$NON-NLS-1$ } return repository; } 。。。 }
具体修改后的源代码文件以及生成的类文件在附件中。
新的版本
将改为rdbms
并且,默认的资源库配置文件在其主用户目录的.kettle文件夹下
查看用户主目录的方法如下:
linux:
su 用户
cd ~/
就可以看到当前的用户目录
或者 echo $HOME
...
相关推荐
8.3.0.0-371 pentaho-kettle kettle-core
pentaho4.8版本的汉化总结 其中包含绝大部分的汉化
pentaho-Kettle安装及使用说明(例子). pentaho-Kettle安装及使用说明(例子).
pentaho kettle中文开发手册
pentaho最新最全配置,保证配置能通过!
ETL(Extract-Transform-Load的缩写,即数据抽取、转换、装载的过程, 我们经常会遇到各种数据的...Kettle 支持图形化的GUI设计界面,然后可以以工作流的形式流转,熟练它可以减少非常多的研发工作量,提高工作效率。
pentaho-kettle是开源的etl工具,这个是自编译的kettle9.5版本pdi-ce-9.5.0.1-261,请使用JDK17运行,支持macos m1芯片 win,linux,解压就能用。如果有条件也可以自己编译,具体可以看我的csdn博客,kettle 从9.4 ...
pentaho kettle-engine-8.3.0.0-371.jar
pentaho-kettle-9.0.0.2源码
Kettle 改名啦!!! 现在叫 Pentaho Data Integration Kettle9.4版本 Pentaho Data Integration 9.4 PDI 9.4 下载地址: ...
pentaho kettle PDI 9.2下载
pentaho-kettle-7.1.0.1属于etl交换开源工具kettle的源码,包括数据同步、插入更新等
使用Pentaho kettle 批量下载文件 的示例代码 包含三个文件,按执行顺序依次为:main.kjb、filelist.ktr、download.kjb。 压缩包中有2个版本的源码。 一个源码是从“txt文件”中读入URL路径,下载文件; 一个源码是...
1、下载即可使用 2、windows和linux分别运行不同的文件 3、其他版本的可参考https://sourceforge.net/projects/pentaho/files/Data%20Integration/
pentaho-kettle的基础教程,在这里可以快速的了解到如何使用pentaho平台下的kettle开发工具。
pentaho kettle PDI 9.2下载
kettle-8.3源码
pentaho应用软件使用手册,对于初学者很有用,有实例参考