Extension

Commerce Cloud contains lots of business logic or code, which provides the several eCommerce solutions. These logic are separated into a package according to its use. These packages are called Extension:

In Commerce Cloud an extension can contain business logic, type definitions, a web application or a Management Console Configuration. In simple words, the programming that we add to the basic package is called an extension.

Command : extgen

Naming Convension:

  • it contains only small letters.
  • contains no space

Example : following are some extensions:

  • voucher extension: provides voucher and coupon functions
  • payment extension: provides payment related code base
  • saporder extension: provides SAP order integration
  • solrfacetsearch extension: provides Solr search engine for search functionality

Basic Structure of extension:

Lets take an example of one extension:

acceleratorservices: folder structure is given below

I will explain here some important packages which are mostly being used in development.

1. resource:

This folder in extensions are basically used for all kind of configurations.

3 basic configuration files:

  • <extension-name>-beans.xml
  • <extension-name>-Items.xml
  • <extension-name>-spring.xml
Extension structure

Tips: These 3 files are always being present in every extensions. In the further chapter we will explain the structure and use of it.

2. src:

This folder always contain the business logic or code .It means we can found all the java files of related  extensions in this folder

extensions-src

3. project.properties :

This file contains all the properties which can be used in the project related to its extensions. You can also add custom properties by yourself. We  will explain this in further lesson.

extensions-project-properties

4. testsrc:

here you can write test classes : unit test, integration test etc.

extensions-testsrc

5. extensioninfo.xml:

in this xml file we setup dependencies of other extension. For setting dependencies of other extensions in your extensions we use requires-extension tag.

Example : <requires-extension name=”cms2″/>

extensions-ext-info-xml

6. lib:

Here we can store libraries like .zar file , which can be used in your implementation:

ext-lib

Example : in acceleratorservices extensions we use following .zar and you can find these .zar files in lib folder.

  • yimpexgenerator-2.0.0.0.jar
  • commons-net-3.0.1.jar
  • jacoco.ant-0.7.6.201602180812.jar
  • reactor-core-1.1.6.RELEASE.jar
  • velocity-tools-2.0.jar