Extension Components
An extension may include coremodule or webmodule components that serve as structural elements with each of them offering a specific set of functionality. As a result, the components you choose to implement affects the functionality of your extensions.
The following components can be available per extension:
- coremodule
- Contains declarations and localizations of types as well as Jalo item classes.
- webmodule
- Contains web applications.
For more information about which components are part of specific extensions, see Checking Installed Extensions.
coremodule Component
The core component contains the following:
-
Type system definitions
The definitions are determined by the content of the items.xml file. The items.xml file is located in the extension's resources directory. The name of this file is always defined accordingly: <$extension> -items.xml where <$extension> is the name of an extension.
-
Java source code files
The files are the type-related Java source files of an extension.
-
Extension version
The resources directory of an extension contains a file called <$extension>.<build.number>. For example, it's called mediaweb.build.number for the mediaweb extension. This file also contains internal control data.
In addition, every SAP Commerce package contains a <build.number> file without a prefix. This file contains the same information as the <$extension>.<build.number> files, except it also has a list of the extensions included in the package.
-
Localization files
The resources/localization directory contains the extension's types and types' attributes localization files.
webmodule Component
The web component is the part of an extension that is accessible via a web browser, such as the SAP StoreFoundation.
To launch the component 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.
For more information, see Platform Filters.
External Libraries
You can use any number of external libraries in an extension.
Here are some potential locations for external libraries:
|
Directory Within the Extension |
Corresponding Extension Component |
Description |
Examples of Libraries Typically Located Here |
|---|---|---|---|
|
/lib |
coremodule |
The /lib directory contains libraries that are required for the extension itself to function. Libraries in this directory are part of the global ServiceLayer scope of the module dependencies. They may also be used by other extensions provided that they declare a proper extension dependency to this one. Bear that in mind when removing a library from this location. While it may not be required by this extension, other extensions may still depend on it. |
|
|
/web/webroot/WEB-INF/lib |
webmodule |
The /web/webroot/WEB-INF/lib null directory contains libraries that are required for the web component to function. As libraries located in this directory are loaded by the web app classloader, they are only visible to the web application itself and cannot be accessed from core components of other extensions. For more information, see Extension Dependencies. |
|
External Dependencies
Third-party dependencies of SAP Commerce extensions are defined in regular maven pom.xml files called external-dependencies.xml. The location of the external-dependencies.xml depends on which component the extension contains.
The following table indicates where the external-dependencies.xml is located for each extension component:
|
Component |
Location |
|---|---|
|
coremodule |
The extension's root directory |
|
webmodule |
The extension's web/webroot/WEB-INF directory |
Extensions can have either a core or web component, or both.
The core component libraries defined in all extensions are loaded by one SAP Commerce-wide class loader. Therefore, it is important to check for duplicates or different versions of the same library. You can use the VersionEye tool to automate this process.
During the extension distribution process, a zip file is created that contains the external-dependencies.xml files that belong to a given extension. This zip file is used by the VersionEye tool to give early feedback about outdated libraries and invalid software licenses.
During the SAP Commerce distribution process, all external-dependencies.xml files from the zip files created during the extension distributed process are combined into one dependencies zip file. The VersionEye tool checks this file to ensure that everything is OK on the SAP Commerce level.
JUnit Tests
The JUnit framework allows you to write and execute unit tests. SAP Commerce provides a framework for automatically executing JUnit tests, and you can implement them for the core component.
Since the JUnit test files of an extension are not contained in an extension component, the test files do not have to be defined by a tag in the extensioninfo.xml file. Alternatively, the extension needs a testsrc directory in order for the yunit ant target to run the tests. If the extension does not have this directory, the tests fail with an error message.
