Plug-in Architecture
Elastic Path Core Commerce uses a lightweight plug-in architecture based on Spring functionality. This architecture allows you to create plug-ins that work with existing Core Commerce modules, without needing to make any changes to the core application code or configuration files.
The Spring contexts of Elastic Path applications use wildcards to include Spring configuration files from well-known classpath locations. There are two patterns:
The first pattern is for the plug-ins to be included from an
extensions
moduleFor example, the
elastic-path-servlet.xml
file in theextensions/integration
module contains:<import resource="classpath*:META-INF/elasticpath/conf/spring/plugin.xml"/> <import resource="classpath*:META-INF/conf/ep-core-plugin.xml"/>
The second pattern is for the extensions to be included from a
commerce-engine
moduleFor example the
import-export-context.xml
file in theep-importexport
module contains:<import resource="classpath*:META-INF/conf/ep-core-plugin.xml"/> <import resource="classpath*:META-INF/conf/ep-importexport-plugin.xml" />
These statements cause the application to examine all JAR
s on the classpath and automatically include any copies of these files.
There are three separate plug-in conventions in these examples:
<import resource="classpath*:META-INF/elasticpath/conf/spring/plugin.xml>
This is used to automatically import Spring configuration from any
JAR
on the classpath with aplugin.xml
file inMETA-INF/conf/ep-core-plugin.xml
. Modules that declare Spring configuration in this location must not rely on any specific order in which theirplugin.xml
file is processed.Examples of modules that use this convention are the
ep-messaging-camel
module, and most Accelerator Kit modules.<import resource="classpath*:META-INF/conf/ep-core-plugin.xml>
This is used to import the
ext-core
module’s configuration into otherextensions
modules. The import should always be done after the genericplugin.xml
imports to allow overriding genericplugin.xml
configuration inext-core
.<import resource="classpath*:META-INF/conf/ep-importexport-plugin.xml>
This is defined in
ep-import-export
to create an extension point that is implemented by theep-importexport-plugin.xml
file in theext-importexport
extension module.