『壹』 如何去看kettle 6.0的源碼
6我沒看過,4倒是看過,網上有文檔的,它會大致的告訴你KETTLE的代碼結構
『貳』 求Kettle 源代碼 下載地址及 Kettle java api教程...
http://kettle.pentaho.com/下載地址!想要什麼自己選
http://wiki.pentaho.com/display/EAI/Getting+Started基礎教程
http://wiki.pentaho.com/display/EAI/Pentaho+Data+Integration+Steps詳細教程
對,就是這些地址
『叄』 kettle源碼在idea上部署運行時出錯
如果java_home設置了,下面可以不用設置,如果提示JVM不能正常啟動
Could not find themain class. Program will exit!
可以設置環境變數:pentaho_java_home,例如:C:\Program Files\Java\jdk1.7.0_79,其實就是你的java安裝目錄,1.6以上即可。windows下
如果啟動還報錯「could not create the Java virtual machine」,不是java虛擬機出了問題,修改一下spoon.bat里內存配置
if "%PENTAHO_DI_JAVA_OPTIONS%"=="" setPENTAHO_DI_JAVA_OPTIONS="-Xms2058m" "-Xmx1024m""-XX:MaxPermSize=256m"
改為
if "%PENTAHO_DI_JAVA_OPTIONS%"=="" setPENTAHO_DI_JAVA_OPTIONS="-Xms512m" "-Xmx512m" "-XX:MaxPermSize=256m"
『肆』 kettle怎樣連接資料庫連接
java調用kettle資料庫類型資源庫中的ktr此問題在1個月前或許已經接觸,單是一直木有怎麼用到,就被耽擱至今;問題的解決要來源於網路,其實我還想說問題的解決的是要靠我們自己的思想,不過多的言情,我們接下來直接進入主題吧!環境:kettle-spoon4.2.0,oracle11g,myeclipse6.5,sqlserver2008前提:在kettle圖形界面spoon裡面已經做好了一個ktr轉換模型,此時我的ktr信息如下圖:Step1:在myeclipse創建project,導入kettle集成所需要的包Step2:重點解析與code源碼//定義ktr名字privatestaticStringtransName="test1";//初始化kettle環境KettleEnvironment.init();//創建資源庫對象,此時的對象還是一個空對象=newKettleDatabaseRepository();//創建資源庫資料庫對象,類似我們在spoon裡面創建資源庫DatabaseMetadataMeta=newDatabaseMeta("enfo_bi","Oracle","Native","ip","sid","port","username","password");//資源庫元對象,名稱參數,id參數,描述等可以隨便定義=("enfo_bi","enfo_bi","kingdescription",dataMeta);//給資源庫賦值repository.init(kettleDatabaseMeta);//連接資源庫repository.connect("admin","admin");//根據變數查找到模型所在的目錄對象=repository.findDirectory("/enfo_worker/wxj");//創建ktr元對象TransMetatransformationMeta=((Repository)repository).loadTransformation(transName,directory,null,true,null);//創建ktrTranstrans=newTrans(transformationMeta);//執行ktrtrans.execute(null);//等待執行完畢trans.waitUntilFinished();上面的兩個步驟才可以確定是資源庫中的那個路徑下的ktr和我們用命令執行一樣的-dir,-tran-job附上源碼:packagekettle;importorg.pentaho.di.core.KettleEnvironment;importorg.pentaho.di.core.database.DatabaseMeta;importorg.pentaho.di.core.exception.KettleException;importorg.pentaho.di.repository.Repository;importorg.pentaho.di.repository.RepositoryDirectoryInterface;importorg.pentaho.di.repository.kdr.KettleDatabaseRepository;importorg.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta;importorg.pentaho.di.trans.Trans;importorg.pentaho.di.trans.TransMeta;/***Title:java調用kettle4.2資料庫型資料庫中的轉換*Description:*Copyright:Copyright()2012*/{privatestaticStringtransName="test1";publicstaticvoidmain(String[]args){try{//初始化kettle環境KettleEnvironment.init();//創建資源庫對象,此時的對象還是一個空對象=newKettleDatabaseRepository();//創建資源庫資料庫對象,類似我們在spoon裡面創建資源庫DatabaseMetadataMeta=newDatabaseMeta("enfo_bi","Oracle","Native","ip","sid","port","username","password");//資源庫元對象,名稱參數,id參數,描述等可以隨便定義=("enfo_bi","enfo_bi","kingdescription",dataMeta);//給資源庫賦值repository.init(kettleDatabaseMeta);//連接資源庫repository.connect("admin","admin");//根據變數查找到模型所在的目錄對象,此步驟很重要。=repository.findDirectory("/enfo_worker/wxj");//創建ktr元對象TransMetatransformationMeta=((Repository)repository).loadTransformation(transName,directory,null,true,null);//創建ktrTranstrans=newTrans(transformationMeta);//執行ktrtrans.execute(null);//等待執行完畢trans.waitUntilFinished();if(trans.getErrors()>0){System.err.println("TransformationrunFailure!");}else{System.out.println("Transformationrunsuccessfully!");}}catch(KettleExceptione){e.printStackTrace();}}}
『伍』 我將kettle集成的項目中,發現內存一直釋放不掉,求解決:
同問:目前只發現怎麼把內存加大。但即使加到1440M又如何一樣會出錯
而且我還是將job分開處理的 多次調用 目前來說是內存使用已經最小了
但還是在處理到1/3的時候就溢出了 頭痛的是這個溢出不是100%出現
求解決
這個問題已經解決了 我們實在沒辦法 把kettle源碼改掉了
kettle 4.2版中 kettle-core.jar 包下org.pentaho.di.core.logging.LoggingRegistry
第115行出現邏輯錯誤刪除了為空的數據導致空指針異常
聽說其他版本沒這個問題 你可以試試
『陸』 配置完kettle用寫java代碼么
1.2.
編譯源碼
將項目載入到eclipse
將kettle項目拷貝到eclipse的workspace目錄下,在eclipse中新建java
project,項目名稱和你拷貝過來的kettle文件夾名稱一致
項目導入到eclipse中會出現一個錯誤,如下圖,將這個文件的源碼全部注釋掉
編譯
打...
『柒』 kettle源碼是完全公開的嗎
2.3以前是公開的,但谷歌宣布,以後的版本就是有償使用的了
『捌』 使用kettle整合新的三層結構的資料庫,該怎麼玩,怎麼修改代碼
資源庫
默認資料庫連接為全局共有
非資源庫
a) 將資料庫連接進行共享,view-database connections-share
b) 設置為全局變數,在kettle.properties文件中,將資料庫連接各屬性配置為變數
『玖』 如何使用kettle源碼更改spoon的東西
1.2. 編譯源碼
將項目載入到eclipse
將kettle項目拷貝到eclipse的workspace目錄下,在eclipse中新建java project,項目名稱和你拷貝過來的kettle文件夾名稱一致
項目導入到eclipse中會出現一個錯誤,如下圖,將這個文件的源碼全部注釋掉
編譯
打開build.xml, 在右邊的。Outline 點擊kettle->run as ->ant build
第一次編譯的時候需要從網上下載幾個文件,放在C:\Documents and Settings\Administrator\.subfloor,網路不好的話下載會比較慢,也可以直接文件放在C:\Documents and Settings\Administrator\下。編譯完成後將bin目錄下的.bat文件拷貝到Kettle目錄下點擊Spoon.bat運行,運行成功代表編譯已近通過
用源碼運行Spoon
Kettle源碼工程本身可能是在linux64位機器上調試的,swt配置是linux64的庫,所有在運行源碼前需要修改成win32的swt,步驟如下:工程à屬性àJava Build Pathàlibrariesàadd jars
然後將linux64的SWT庫刪除
最後打開src-uiàorg.pentaho.di.ui.spoonàSpoon.java, Run As àjava application
二.源碼分析
2.1. 修改kettle界面
修改初始化界面
打開package org.pentaho.di.ui.spoon的Spoon.Java,找到main函數,該main函數為Spoon工具的入口,找到如下語句
Splash splash = new Splash(display);
該語句為spoon初始化顯示的界面,跳到定義Splash.java,下面函數
canvas.addPaintListener(new PaintListener() {
publicvoid paintControl(PaintEvent e) {
String versionText = BaseMessages.getString(PKG, "SplashDialog.Version") + " " + Const.VERSION; //$NON-NLS-1$ //$NON-NLS-2$
StringBuilder sb = new StringBuilder();
String line = null;
try {
BufferedReader reader = new BufferedReader(newInputStreamReader(Splash.class.getClassLoader().getResourceAsStream("org/pentaho/di/ui/core/dialog/license/license.txt")));//$NON-NLS-1$
while((line = reader.readLine()) != null) {
sb.append(line + System.getProperty("line.separator")); //$NON-NLS-1$
}
} catch (Exception ex) {
sb.append(""); //$NON-NLS-1$
Log.warn(BaseMessages.getString(PKG, "SplashDialog.LicenseTextNotFound")); //$NON-NLS-1$
}
String licenseText = sb.toString();
e.gc.drawImage(kettle_image, 0, 0);
// If this is a Milestone or RC release, warn the user
if (Const.RELEASE.equals(Const.ReleaseType.MILESTONE)) {
versionText = BaseMessages.getString(PKG, "SplashDialog.DeveloperRelease") + " - " + versionText; //$NON-NLS-1$ //$NON-NLS-2$
drawVersionWarning(e);
} elseif (Const.RELEASE.equals(Const.ReleaseType.RELEASE_CANDIDATE)) {
versionText = BaseMessages.getString(PKG, "SplashDialog.ReleaseCandidate") + " - " + versionText; //$NON-NLS-1$//$NON-NLS-2$
}
elseif (Const.RELEASE.equals(Const.ReleaseType.PREVIEW)) {
versionText = BaseMessages.getString(PKG, "SplashDialog.PreviewRelease") + " - " + versionText; //$NON-NLS-1$//$NON-NLS-2$
}
elseif (Const.RELEASE.equals(Const.ReleaseType.GA)) {
versionText = BaseMessages.getString(PKG, "SplashDialog.GA") + " - " + versionText; //$NON-NLS-1$//$NON-NLS-2$
}
Font verFont = new Font(e.display, "Helvetica", 11, SWT.BOLD); //$NON-NLS-1$
e.gc.setFont(verFont);
e.gc.drawText(versionText, 290, 205, true);
// try using the desired font size for the license text
int fontSize = 8;
Font licFont = new Font(e.display, "Helvetica", fontSize, SWT.NORMAL); //$NON-NLS-1$
e.gc.setFont(licFont);
// if the text will not fit the allowed space
while (!willLicenseTextFit(licenseText, e.gc)) {
fontSize--;
licFont = new Font(e.display, "Helvetica", fontSize, SWT.NORMAL); //$NON-NLS-1$
e.gc.setFont(licFont);
}
e.gc.drawText(licenseText, 290, 290, true);
}
});
1. 修改背景圖片
找到ui/image/下面的kettle_splash.png,替換該圖片
2. 修改版本信息
找到e.gc.drawText(versionText, 290, 205, true); 改為e.gc.drawText("海康威視數據交換平台V1.0", 290, 205, true);
3. 修改下面的描述性文字
找到e.gc.drawText(licenseText, 290, 290, true);改為e.gc.drawText("作者:海康", 290, 290, true);
4. 預覽效果
『拾』 kettle源碼搭建運行時出現錯誤
將安裝包pdi-ce-5.4.0.1-130\data-integration\ui目錄下的所有文件拷貝到源碼包pentaho-kettle-5.4.0.1-R\ui目錄下,即可解決~~