版本号:v1.06 2020年11月24日
所有的架构图在这个单独的帖子里。
导航目录
- SAP官方帮助文档
- configuration
- 如何运行
- Filters
- 容器化支持
- Installer-Recipe
- Extension和Addon的概念
- Internationalization-and-localization
- ant
- Hybris-initialization和update过程
- Model
- SAP-Commerce里的Spring框架
- Accelerator
- API-registry
- search-and-navigation
- solr-server
- Module
- 开发环境相关
- Service-Layer
- Hybris-Type-System
- Platform-Services-and-Utilities
- platform module feature
- platform module architecture
- platform module implementation
- Distribution-process
- cache
- Charon
- Cluster
- container-support
- filters
- Impex - 使用api导入导出数据
- Internationalization-and-Localization
- Jalo-Layer
- Jalo-session
- logging
- media
- oauth2
- order
- europe1
- Ordering-Process
- payment
- Processing
- Global Templates
- Product建模的两种方式
- type-system
- 所有可用的类型列表
- items.xml详述
- dynamic-attribute
- Enumerations
- script
- search
- Chinesepaymentservices
- backoffice
- 其他网友的资料
SAP官方帮助文档
configuration
配置文件和运行时在admin console里两种方式
The HYBRIS_RUNTIME_PROPERTIES environment variable allows you to set a path that points to a custom properties file.
运行时动态更新配置:RuntimeConfigLoader,定期轮询properties文件是否有变化。
配置文件的编码问题:encoding
默认: ISO 8859-1
configuration template是一系列配置文件的集合,分devlelop和production两种,结构如下:
- A local.properties file
- Configuration files for Apache Tomcat, such as wrapper.conf or wrapper-debug.conf
- A license file
两种配置文件:project.properties and local.properties.
Project properties are the SAP Commerce defaults, while local properties is where you may define your own configuration for your extension.
- The project.properties file is located in the <HYBRIS_BIN_DIR>/platform directory, and provides factory default settings. It is not recommended to edit this file.
- The local.properties file is a working copy of the project.properties file, located in the <HYBRIS_CONFIG_DIR> directory. It allows you to override default settings from the project.properties file.
- bin/platform: The core SAP Commerce platform extensions that are loaded on startup. This directory also has the build framework, and extension templates.
- data: Data files such as media files and LucerneSearch indexes. The directory also contains HSQLDB data files, if you are using the default database in a test or development environment.
- log: Log files, including Tomcat and JDBC logs.
NEVER change anything within the bin directory. Do not keep any custom data configuration in this directory or any of the subdirectories. The upgrade process may replace the bin directory and subdirectories with a newer version of SAP Commerce and remove your changes.
如何运行
默认的数据库:HSQLDB
第三方软件需求
- SAP Commerce 1905 requires JDK 11 or later. It is fully compatible with SAP Machine 11.
- 如何下载安装包
Navigate to the <${HYBRIS_BIN_DIR}> /platform directory, call ant clean all to build the entire SAP Commerce solution.
Filters
包含一些默认filters的功能介绍。清单在这里
容器化支持
Installer-Recipe
- 不能用于生产用途。文件夹位置:installer/recipes. 这个链接包含了所有recipe的说明。
License文件:<HYBRIS_HOME>/config/license/installedSaplicenses.properties
如何生成license file
也不能在一个目录里重复安装不同的recipe:
Don’t use the installer to run one recipe after another on the same SAP Commerce. The installer won’t uninstall previous configurations, and doesn’t restore your SAP Commerce file system to its original settings. To install a different recipe, use a clean environment.
Extension和Addon的概念
- 若干extensions组合在一起,以module的形式发布。
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.
Addon是一种特殊的extension,扩展了Commerce Accelerator的功能。这种extension添加了UI页面,但又没有直接修改Storefront的实现。
AddOns extend the functionality of the SAP Commerce Accelerator. They are a type of extension that allow you to add front-end files such JSP, HTML, CSS, and JavaScript files, and images without modifying the storefront front-end files directly.
SAP Commerce Accelerator is built on an extensive framework that includes a template for storefront implementation. AddOns and extensions provide a well-defined infrastructure for third party developers to plug in their own functionality.
Using AddOns, you can extend the functionality of Commerce Accelerator without editing the core code base. The core code base in this context means the Commerce Platform, and all additional extensions delivered with Commerce Accelerator. An AddOn is a regular extension that may, or may not, provide additional front-end components to Commerce Accelerator.
Addon也是一种Extension,Storefront extension被addon扩展,在其extesnioninfo.xml里引用这个addon:
An AddOn is a regular SAP Commerce extension that is configured using the extensioninfo.xml file, located in the root folder of the AddOn. Additionally, the storefront extension that is extended by an AddOn has to reference this AddOn in the extensioninfo.xml file. The structure of this file is exactly the same as any regular extension.
Addon是accelerator Storefront的扩展技术。典型的文件夹层级结构:
the web folder contains both the src and the webroot subdirectories. After putting all the components you want to add into the proper folders, you need to run the following command on your system: ant build.
一旦build,会自动拷贝文件到Storefront Extension里,自动创建新的文件夹来容纳拷贝的文件:
- web/addonsrc, which contains the source code for each installed AddOn. This gets compiled automatically.
- web/webroot/WEB-INF/addons, which contains all the front-end components, such as images, JSP files, HTML files, and TAG files.
acc一旦升级,也不会覆盖掉我们的addon.
如果addon里直接添加jsp,css,图片等,不需要build platform, 如果添加新的java code到target Extension,就需要build platform.
The front-end items are stored in the acceleratoraddon folder of an AddOn. The structure within the acceleratoraddon folder mirrors the folder structure within the web folder, which contains the front-end components of a regular extension.
Addon里的accelerator文件夹是如何拷贝到Storefront文件夹里的?规则在这个链接里。
source: <addon_name>/acceleratoraddon/web/webroot/_ui
target: /web/webroot/_ui/addons/<addon_name>
source: <addon_name>/acceleratoraddon/web/src
target: /web/addonsrc/<addon_name>, 装的java代码。文件copy由build callback实现:
- The system scans for every extension that has a specific acceleratoraddon folder. Marker folders are defined as follows:
- ${extension-path}/acceleratoraddon/web/webroot/_ui
- ${extension-path}/acceleratoraddon/web/webroot/WEB-INF
- For each AddOn that is found, the system identifies the target extension.
For each resource that is found in the acceleratoraddon folder, the system copies the contents to the target extension.
在beans.xml里也可以给DTO增加新的属性:
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="beans.xsd">
<bean class="de.hybris.platform.commercefacades.product.data.ProductData">
<property name="weight" type="int" />
<property name="instruction" type="String" />
<property name="additionalImage"
type="de.hybris.platform.commercefacades.product.data.ImageData" />
</bean>
<enum class="de.hybris.platform.commercefacades.product.ProductOption">
<value>DIMENSIONS</value>
<value>MINIMAL</value>
</enum>
</beans>
Similarly to the item.xml file, the definitions in the beans.xml file are merged automatically. In the example above, the ProductData file is not part of our example extension, but it is extended from the commerceservices extension. That means that during this process, you extended the API because you modified the data model. You do not need to replace the facade in this instance. All you need to do is plug in the populator from your extension, and it can be done multiple times.
这个链接包含了一个表格,可以查询Extension和Addon的ID和description.
一步步创建一个新的addon
An extension is an encapsulated piece of software that extends SAP Commerce functionality by either modifying existing features, or introduction new features.
Extension modules are structural elements of an extension.
Extension module是extension的一部分。
You can implement JUnit tests for the extension’s core extension module. The files for these JUnit tests must be located in the testsrc directory of the extension.
每个extension都有一个名叫core的 extension module,包含了该extension的type system definition,items.xml, 位于resources文件夹内。命名规范:
The name of this file is always defined accordingly: < e x t e n s i o n > − i t e m s . x m l w h e r e < extension> -items.xml where < extension>−items.xmlwhere<extension> is the name of an extension.
与类型相关的Java source code文件也位于core extension module内。
Processing也是extension.
items.xml的链接.
- web extension module: 是extension的一部分,可以通过浏览器访问:
To launch a web extension module via your web browser, go to the URL path to Platform on the server/name of extension/starting page. For example, if you are running myExtension locally on default settings, the URL would be http://localhost:9001/myExtension.