當前位置:首頁 » 操作系統 » pentaho源碼

pentaho源碼

發布時間: 2022-06-29 05:52:47

java 怎麼設置kettle資料庫

java調用kettle資料庫類型資源庫中的ktr
此問題在1個月前或許已經接觸,單是一直木有怎麼用到,就被耽擱至今;問題的解決要來源於網路,其實我還想說問題的解決更多的是要靠我們自己的思想,不過多的言情,我們接下來直接進入主題吧!
環境:kettle-spoon 4.2.0,oracle11g,myeclipse6.5,sqlserver2008
前提:在kettle圖形界面spoon裡面已經做好了一個ktr轉換模型,此時我的ktr信息如下圖:

Step1:在myeclipse創建project,導入kettle集成所需要的包

Step2:重點解析與code源碼
//定義ktr名字
private static String transName = "test1";
//初始化kettle環境
KettleEnvironment.init();
//創建資源庫對象,此時的對象還是一個空對象
KettleDatabaseRepository repository = new KettleDatabaseRepository();
//創建資源庫資料庫對象,類似我們在spoon裡面創建資源庫
DatabaseMeta dataMeta =
new DatabaseMeta("enfo_bi","Oracle","Native","ip","sid","port","username","password");
//資源庫元對象,名稱參數,id參數,描述等可以隨便定義
KettleDatabaseRepositoryMeta kettleDatabaseMeta =
new KettleDatabaseRepositoryMeta("enfo_bi", "enfo_bi", "king description",dataMeta);
//給資源庫賦值
repository.init(kettleDatabaseMeta);
//連接資源庫
repository.connect("admin","admin");
//根據變數查找到模型所在的目錄對象
RepositoryDirectoryInterface directory = repository.findDirectory("/enfo_worker/wxj");
//創建ktr元對象
TransMeta transformationMeta = ((Repository) repository).loadTransformation(transName, directory, null, true, null ) ;
//創建ktr
Trans trans = new Trans(transformationMeta);
//執行ktr
trans.execute(null);
//等待執行完畢
trans.waitUntilFinished();

上面的兩個步驟才可以確定是資源庫中的那個路徑下的ktr和我們用命令執行一樣的-dir ,-tran -job
附上源碼:

package kettle;
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.repository.Repository;
import org.pentaho.di.repository.RepositoryDirectoryInterface;
import org.pentaho.di.repository.kdr.KettleDatabaseRepository;
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;
/**
* <p>Title: java調用kettle4.2資料庫型資料庫中的轉換</p>
* <p>Description: </p>
* <p>Copyright: Copyright () 2012</p>
*/
public class ExecuteDataBaseRepTran {

private static String transName = "test1";

public static void main(String[] args) {

try {
//初始化kettle環境
KettleEnvironment.init();
//創建資源庫對象,此時的對象還是一個空對象
KettleDatabaseRepository repository = new KettleDatabaseRepository();
//創建資源庫資料庫對象,類似我們在spoon裡面創建資源庫
DatabaseMeta dataMeta =
new DatabaseMeta("enfo_bi","Oracle","Native","ip","sid","port","username","password");
//資源庫元對象,名稱參數,id參數,描述等可以隨便定義
KettleDatabaseRepositoryMeta kettleDatabaseMeta =
new KettleDatabaseRepositoryMeta("enfo_bi", "enfo_bi", "king description",dataMeta);
//給資源庫賦值
repository.init(kettleDatabaseMeta);
//連接資源庫
repository.connect("admin","admin");
//根據變數查找到模型所在的目錄對象,此步驟很重要。
RepositoryDirectoryInterface directory = repository.findDirectory("/enfo_worker/wxj");
//創建ktr元對象
TransMeta transformationMeta = ((Repository) repository).loadTransformation(transName, directory, null, true, null ) ;
//創建ktr
Trans trans = new Trans(transformationMeta);
//執行ktr
trans.execute(null);
//等待執行完畢
trans.waitUntilFinished();

if(trans.getErrors()>0)
{
System.err.println("Transformation run Failure!");
}
else
{
System.out.println("Transformation run successfully!");
}
} catch (KettleException e) {
e.printStackTrace();
}
}

}

㈡ 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"

㈢ pentaho需要在linux系統中開發嗎

下載源碼Pentaho BI Server打包後的文件存於這里,其中包括(本文使用的是3.9.0版本):biserver-ce-3.9.0-stable.zip,bi-platform-3.9.0-stable-sources.zip,biserver-ce-3.9.0-stable-javadoc.zip。 將biserver-ce-3.9.0-stable.zip解壓之後...

㈣ 如何讓Pentaho Aggregation Designer整合hive的數據源

最近需要進行利用pentaho聚合設計器實現hive數據倉庫中表的聚合,但是目前的pentaho aggregation designer不支持hive的連接類型,想問下有沒有牛人研究過pentaho aggregation designer的源碼或是有別的方法直接將hive-jdbc加進去就可以使用

㈤ 我看到你關於kettle不釋放內存的回答,想要一下你改完後org.pentaho.di.core.logging.LoggingRegistr源碼

你留個郵箱或者qq吧 網路hi怎麼發文件我還不怎麼清楚

㈥ Pentaho BI可以和ECharts或者D3結合使用嗎有使用的例子嗎

pentaho可以安裝一個cde的插件,你說的ECharts我沒用過,但cde我覺得應該和你要的差不多,你可以試試這個

㈦ 如何使用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. 預覽效果

㈧ 怎麼安裝pentaho

手把手教你安裝配置
pentaho
分類:

java
2011-04-15 17:32 515
人閱讀

評論
(0)
收藏

舉報

目錄

Pentaho
的手動配置
........................................................................................................................ 1

01.
在你開始前

.
...................................................................................................................................... 1

02.
下載

J2EE Deployment Distribution ............................................................................................ 1

04.
配置

Solutions
................................................................................................................................ 2

05.
構建應用

archives .......................................................................................................................... 3

06.
配置應用

Archives
.
......................................................................................................................... 5

Enabling SSL in Tomcat55 & JBoss
.
............................................................................................... 5

JBoss 4.0.4
......................................................................................................................................... 6

改變伺服器埠

.............................................................................................................................. 7

Tomcat 5.0
.......................................................................................................................................... 8

Tomcat 5.5
........................................................................................................................................ 11

Pentaho
的手動配置

This page last changed on Jan 28, 2007 by
bhagan.

為了配置

Pentaho BI
平台,
首先你必須有一個
J2EE
兼容的
archive
文件

其包含了平台的所有文件和資源。如果你使用

JBoss


Tomcat
作為你的應
用伺服器,這個指南會幫助你構建

archive
。如果你正使用一個不同的應用服
務器,你需要編寫你自己的

Ant
任務來構建你需要的

archive
,並添加特定
於你的應用伺服器的配置文件。

如果你願意的話,我們很高興將你的應用程序伺服器的

Ant
任務放進我們的
包中。參與

Pentaho
的細節信息請
參考

http://www.pentaho.org/contributions


Pentaho
有一個預配置的

JBoss
應用伺服器,其中已經為你配置好了
一切。如果想盡快省力的配置運行,我們推薦使用預配置安裝包。這個
指南為那些想在自己的環境中設置平台的人提供了一種選擇。

01.
在你開始前

This page last changed on Jan 30, 2007 by
bhagan.

你也需要確保你已經有:



這個指南需要
已經安裝了

Java SDK



JRE

Pentaho BI
平台在

Java SDK 1.4
上構建和測試過,
Java SDK 1.4
的各種平台上的版本
可在此處下載

http://java.sun.com/j2ee/1.4/download.html#sdk




確保環境變數

JAVA_HOME
指向

JDK
被安裝的目錄。



這個下載也需要
安裝了

Apache Ant
,開放源碼的基於

Java
的構建
工具。你將需要

Ant


1.6.2
版本或更高。你可從

http://ant.apache.org/

下載

Ant




確保

Ant


bin
目錄在你的系統

path
上。

02.
下載

J2EE Deployment Distribution

This page last changed on Jan 30, 2007 by
bhagan.

J2EE
Deployment
Distribution
是一個包,允許你為某種應用程序服務
器構造多種不同的

web
應用
archives

/
或企業應用

archives

到目前
為止,我們有構建以下

archives (
通過

Ant targets)
腳本



Tomcat 5.x .war
文件



JBoss 4.0.4 .war
文件



JBoss 4.0.4 .ear
文件

可在

downloads page

上找到這個包,其名為

pentahoj2ee_deployments


如果你想將之配置到一個沒有列出的應用程序伺服器時,
這也是一個好的起點。
你需要的所有

Pentaho
文件均存在於這個包中,你所需要做的就是編寫你自
己的

Ant target
,並添加你的環境必需的配置文件。

我們主要的應用伺服器測試環境是

JBoss 4.0.4

Pentaho
社區和開發組歡迎
各種反饋

不管是面臨的問題,還是僅僅想讓我們知道你成功配置了環境

關於
在其它應用程序伺服器上的配置。
請使用

http://forums.pentaho.org

上的論壇
共享你的經歷。

03.
配置

Sample
數據

This page last changed on Jan 30, 2007 by
bhagan.














Sourceforge





pentaho_data-<version>.zip

文件。

在資源樹的根目錄上,你會看見啟動和關閉腳本。為啟動資料庫伺服器,
運行

start-hypersonic (.bat
用於

Windows

.sh
用於

*nix)
腳本。為停
止資料庫伺服器,運行

stop-hypersonic
(.bat
用於

Windows

.sh
用於

*nix)
腳本。

建議的目錄結構
如下:

/pentaho

/appserver

/pentaho-data

/pentaho-solutions

04.
配置

Solutions

㈨ 求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源碼搭建運行時出現錯誤

將安裝包pdi-ce-5.4.0.1-130\data-integration\ui目錄下的所有文件拷貝到源碼包pentaho-kettle-5.4.0.1-R\ui目錄下,即可解決~~

熱點內容
c語言中3d是什麼意思 發布:2024-05-01 15:43:40 瀏覽:839
雲伺服器過期了怎麼找回 發布:2024-05-01 15:41:06 瀏覽:261
阿里伺服器甘肅雲空間 發布:2024-05-01 15:35:36 瀏覽:253
陳建斌超級訪問 發布:2024-05-01 15:35:00 瀏覽:88
lol開什麼配置最好 發布:2024-05-01 15:23:37 瀏覽:327
如何在vivo手機裡面的微信設置密碼 發布:2024-05-01 15:22:57 瀏覽:861
四川電信新增伺服器地址雲空間 發布:2024-05-01 15:17:55 瀏覽:706
校園編程調鈴 發布:2024-05-01 15:00:14 瀏覽:837
編譯原理第三版課後習題答案文庫 發布:2024-05-01 14:49:44 瀏覽:976
vs編譯失敗 發布:2024-05-01 14:42:50 瀏覽:722