天天看點

Hybris的extension和ABAP的package

An extension can contain business logic, type definitions, a web application, or a Hybris Management Console configuration. That way, you link up in one place all of the functionality that covers a certain field of use, for example a webshop.

這個概念和ABAP裡的package非常類似。

比如這個alipay是成都團隊開發的一個extension:

典型結構:

UI:

一個細微的差異是,我們知道在ABAP package裡建立的所有object,都可以被其他package的代碼通路。即使這些object沒有加到package interface的visible element裡,runtime也不會報錯。

Hybris的extension裡的大多數folder下的object,通路控制的behavior和ABAP package一緻。除了/web folder下的UI實作:This directory contains the web extension module parts of the extension (JSP files, libraries). Sources and resources from this directory are only accessible to a Web application containing the extension. They cannot be accessed from another extension.

Hybris啟動時加載的extension清單:

注意,即使是很多Hybris core的功能,也是以extension的方式實作的,這一點對于從ABAP轉過來的developer一開始會特别confusing,因為在ABAP裡extension一般意味着屬于partner或者客戶.

比如這個extension,是Hybris core的一部分.

本文來自雲栖社群合作夥伴“汪子熙”,了解相關資訊可以關注微信公衆号"汪子熙"。