ETL Pentaho代碼學習筆記

來源:互聯網
上載者:User

標籤:des   style   ar   io   color   os   sp   strong   on   

1、通過設定KETTLE_HOME環境變數可以讓.kettle不需要在user.home下

2、預設kettle_home 為User.home,如果要自訂需要設定環境變數KETTLE_HOME

3、在.kettle目錄下可放置以下檔案或目錄:

    

       檔案名稱                                    說明
kettle.properties  內部運行時的環境變數 
.languageChoice 

設定啟動並執行語言,方便進行介面語言的翻譯

     --內容LocaleDefault=en_US

             LocaleFailover=en_U

其它 也可以放置Plugins目錄,增加自己的擴充外掛程式

4、外掛程式的類型:

 

類型         Plugin下的目錄         載入XML設定檔名

Step                 steps         kettle-steps.xml

Partitioner steps             …

JobEntry         jobentries     …

Repository repositories     …

Database         databases     …

Lifecycle         repositories     …

Rules         rules                     …

5、外掛程式的載入

 a. 掃描目錄: <kettle_home>/plugins 、<運行目錄>/plugins、<kettle_home>/plugins/<第4點中類型對對應目錄  >、、<運行目錄>/plugins/<第4點中類型對對應目錄>

   說明:前兩個掃描申明,後兩個是掃描XML定義檔案。

  可以將所有定義的類路徑以逗號分隔設定到KETTLE_PLUGIN_CLASSES變數中用於調試。

  b.第一種方式:定義通用Xml格式結構

    (1) steps/step (見kettle-steps.xml)

    下 屬性或元素:id, description, iconfile, tooltip, category(相容i18n), classname, errorhelpfile

  樣本:

  <step id="Injector">

<description>i18n:org.pentaho.di.trans.step:BaseStep.TypeLongDesc.Injector</description> <!-- 

 :外掛程式的名字顯示

                                                                                 以i18n:開頭按:分隔,第一部分是message所在的package路徑,第二部分是它的message key. 

-->

<classname>org.pentaho.di.trans.steps.injector.InjectorMeta</classname>  <!-- 

 :外掛程式對應的類

-->

<category>i18n:org.pentaho.di.trans.step:BaseStep.Category.Inline</category> <!-- 

 :外掛程式分類的名字顯示

                                                                                 以i18n:開頭按:分隔,第一部分是message所在的package路徑,第二部分是它的message key. 

-->

<tooltip>i18n:org.pentaho.di.trans.step:BaseStep.TypeTooltipDesc.Injector</tooltip>

<iconfile>ui/images/INJ.png</iconfile>

</step>

(2) libraries/library (外掛程式引用Jar,可多個)

下 屬性: name (相對當前外掛程式目錄的一個路徑)

(3) localized_category/category (外掛程式的分類顯示文字,可多個)

    下 屬性: locale(指定國家語言代碼,如:en_US,zh_CN

          值:對應的文字  

    (4) localized_description/description(外掛程式標題文字,可多個)

    下 屬性: locale(指定國家語言代碼,如:en_US,zh_CN

          值:對應的文字

    (5) localized_tooltip/tooltip(外掛程式提示文字,可多個)

    下 屬性: locale(指定國家語言代碼,如:en_US,zh_CN

          值:對應的文字

 

  c. 第二種方式: 掃描

    <kettle_home>/plugins 、<運行目錄>/plugins、<kettle_home>/plugins/<第4點中類型對對應目錄>這三個目錄下所有的Jar包的裡面有類型對應的申明的類(這種方式就需要通過定義檔案來完成) 

    類型                  介面                 對應的申明類

  Step                org.pentaho.di.trans.step.StepMetaInterface                org.pentaho.di.core.annotations.Step

  Partitioner   org.pentaho.di.core.annotations.PartitionerPlugin

   JobEntry          org.pentaho.di.job.entry.JobEntryInterface                  org.pentaho.di.core.annotations.JobEntry

   Repository   org.pentaho.di.core.annotations.RepositoryPlugin

   Database   org.pentaho.di.core.plugins.DatabaseMetaPlugin

   Lifecycle   org.pentaho.di.core.annotations.LifecyclePlugin

   ImportRule   org.pentaho.di.core.annotations.ImportRulePlugin

  c. 第三種,載入內建的.xml檔案,如:kettle-engine.jar內根目錄下.xml檔案。

          如:kettle-variables.xml,kettle-steps.xml,kettle-job-entries.xml

  也可以通過環境變數來影響:steps(KETTLE_CORE_STEPS_FILE),JobEntry(KETTLE_CORE_JOBENTRIES_FILE)



 6、效能最佳化提示:可以適當去除一些不需要用到的外掛程式,這樣就會加快Spoon開發工具的啟動速度。

       如:AgileBI等,


ETL Pentaho代碼學習筆記

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.