The Application Framework of Intershop 7 is used to develop applications consisting of Java classes, pipelines, queries, webforms, and other Intershop-specific code artifacts.
The Application Framework distinguishes between:
It is very important not to confuse these two terms.
The code artifacts as well as the application types themselves are deployed into the application server within cartridges.
Concepts:
Cookbooks:
Term | Description |
---|---|
Cartridge | A special deployment component that provides code for the application server |
Domain | A data container in the database |
Site | A special domain containing the session context of users |
Unit | A special type of domains which are mere data containers, e.g., products with their images |
AppEngine | The central registry for all application types |
Application Type | An ApplicationType defines a set of cartridges composing the code base. The corresponding code artifacts may be called Apps. |
Application | The configured relationship of an application type operating on a defined set of data in the context of a website |
Application Suite | Several application types with dependencies to each other fulfill a particular business scenario (e.g., System Administration, Sales Organization) |
ApplicationContext | The execution context of an application created and released for each web request. It may be called AppContext as well. |
Cartridges, see Concept - Cartridges (valid to 7.4), are common file containers, that are deployed into the Intershop application server. They can contain simple files like images and properties as well as code artifacts, like:
An ApplicationType
defines a set of cartridges composing the code base. The CartridgeListProvider
is responsible for defining this cartridge set. All dependent cartridges of this set are added to the code base, too. The resulting set of cartridges is sorted by the global cartridge list provided by the application server startup: IS_SHARE/system/cartridges/cartridgelist.properties. The lookup order is reverse to the Java class path, which means that the code artifacts of cartridges on the right side override code artifacts of cartridges on the left side of the property value.
Intershop 7 is distributed with several application types that interact with each other.
E.g.: The B2C webshop renders products that are managed in the B2C back office.
Further, the B2C back office is able to internally call the B2C webshop.
E.g.: to render the B2C webshop in preview mode. In order to encapsulate particular application types the application suite layer is introduced, which configures particular application types and wires them together.
So, cartridges (e.g. as_sales_organization, as_system) defining and configuring several application types compose an application suite.
The following table lists the available Application Types defined in the Intershop Commerce Management B2C/B2X.
ICM 7.3 - 7.5 | Cartridge | ICM 7.6 - 7.9 | Cartridge | ICM 7.9.1 | Cartridge | ICM 7.10.21.0 | Cartridge | |
---|---|---|---|---|---|---|---|---|
ICM B2C Storefront Types | intershop.B2CWebShop intershop.SMBWebShop | as_sales_organization | intershop.B2CResponsive intershop.SMBResponsive | as_responsive | intershop.B2CResponsive intershop.SMBResponsive | as_responsive | intershop.B2CResponsive intershop.SMBResponsive intershop.REST | as_responsive as_headless |
ICM B2X Storefront Types | intershop.B2CWebShop intershop.SMBWebShop (extends SMBWebShop of B2C) | as_sales_organization | intershop.B2CResponsive intershop.SMBResponsive (extends SMBReponsive of B2C) | as_responsive as_responsive_b2b | intershop.B2CResponsive intershop.SimpleSMBResponsive (equal to SMBResponsive of B2C) intershop.SMBResponsive (extends SMBReponsive of B2C) | as_responsive as_responsive_b2b | intershop.B2CResponsive intershop.SimpleSMBResponsive intershop.SMBResponsive intershop.REST | as_responsive as_responsive_b2b as_headless as_headless_b2b |
ICM B2C/B2X Backoffice Types | intershop.B2CBackoffice intershop.EnterpriseBackoffice intershop.PartnerBackoffice | as_sales_organization | as in 7.5 | as_backoffice | as in 7.5 | as_backoffice | as in 7.5 | as_backoffice |
ICM B2C/B2X System Types | intershop.SLDSystem intershop.SMC intershop.System | as_system | as in 7.5 | as_system | as in 7.5 | as_system | as in 7.5 | as_system |
Additional Types | intershop.ETest | etest | intershop.ETest intershop.CC | etest as_contactcenter | intershop.ETest intershop.CC | etest as_contactcenter | intershop.ETest intershop.CC | etest as_contactcenter |
There are two possibilities to share code in two application types.
Cartridges define their dependencies to other cartridges (see Cartridge Meta Data). The internal code artifact lookup recursively processes the dependencies defined by the CartridgeListProvider
.
E.g., the cartridges app_sf_webshop_b2c and app_sf_webshop_smb depend on the cartridge bc_user. That is why the code of cartridge bc_user is called by both application types intershop.B2CWebShop and intershop.SMBWebShop:
The code in the bc_user cartridge simply uses the named relation UserBORepository
to access the business data of user features for the current application. The creator of the application object needs to make sure that the corresponding relation is created, too.
Another important possibility of code sharing is the inheritance of the existing cartridge lists. In this case an application type is also assigned to all cartridges of an existing application type. The following figure describes how it works:
In this case the application type customer.B2CWebShop is derived from application type intershop.B2CWebShop. This means that the webshop of the customer inherits all the functionality of the standard webshop of Intershop and may overwrite or extend the functionality with its own cartridge customer_sld_ch_b2c_app. This structure results in the following cartridge lists:
ApplicationTypes
are registered at the AppEngine
and will be instantiated during the startup phase of the application server. An ApplicationType
possesses an identifier for references within the code as well as a name and a description for visualization in different applications.
Note
Please note that the lookup order of cartridges is reverse to the Java class path, which means that the code artifacts of cartridges on the right side override code artifacts of cartridges on the left side of the property value.
All application types use the same Java code base. There is no application type-specific ClassLoader
. All other code artifacts are loaded and found using the application type-specific list of cartridges in reverse order than the Java lookup.
An application determines three things that are required to execute a code artifact within the Intershop application server:
The ApplicationContext is the static execution context of an application. This results in the following diagram:
The following things are possible as a result of this design:
Application Switch: Each site can access several applications. That is why it is possible to switch between different applications within one user session.
Note
Both applications need to be session-compatible because objects are shared between the applications in the session dictionary.
The data in the database and file system are assigned to data containers or repositories internally called domain. Domains are persistent objects that are stored in the database. Each domain possesses a system-wide unique name as well as a UUID. Database objects belonging to a domain use foreign keys or at least a column for storing the UUID of the domain. The data in the file system is stored in a particular directory: IS_SHARE/sites/<site>, IS_SHARE/sites/<parentsite>/units/<unit>.
There are two types of Domains: Sites (type code 3) and Units (type code 1). Units are mere data containers. They contain database data of different types and file system content, like images. In general, sites are web sites. They contain the session objects within the application server. Further, the sites are assigned to a parent site and contain an arbitrary number of units.
Applications and domains are persistent objects that are created during the DBInit process or at runtime of the application server (e.g., during creation of a sales organization). There are three tight relations between an application and domains:
Application.getDomain():Domain
returns the owning domain.Application.getSite():Domain
returns the site of the application. A user can switch between applications belonging to the same site.Application.getRelatedDomains(String):List<Domain>
and Application.getRelatedDomain(String):Domain
return one or more domains with a defined role within the application. See:The named relations between applications and domains are introduced to support different business scenarios. The name of the relation represents the role of the domain within the application. From this it follows that one domain may have the same or different roles in several applications (data sharing). Furthermore, one named relation references at least one domain. This is the usual case. It is also possible to assign more than one domain to a relation. In this case they are ordered by a position.
The application types are created during startup of the application server. The applications determine their functionality by referencing the application type.
There are business scenarios requiring different relations between the code and the data of a particular type. The following combinations are possible for two applications:
The following figure shows the data sharing in the back office application. The B2C back office as well as the enterprise back office use separate domains ("DefaultRepository"
) to store their business objects like products, prices and so on. Both applications share the same Organizations repository:
The Intershop code artifacts are executed in the context of an application providing the list of cartridges for the lookup of code artifacts. The following communication diagram describes steps for the creation of an application context:
The application calls the ApplicationContextFactory
object to create the minimum application context. Afterwards, the ApplicationContextFactory
calls each extension implementing the extension point com.intershop.beehive.core.capi.domain.ApplicationContextListener-ApplicationContextFactory
to add their feature-specific objects. For instance, the class ApplicationBOApplicationContextListener
of cartridge bc_application is responsible for:
BusinessObjectContext
ApplicationBO
to the ApplicationContext
. As a result of this, all applications of an application type which references the cartridge bc_application create AppContext
objects with the current ApplicationBO
as well as BusinessObjectContext
.
Note
AppContext objects need to be released.
The Intershop application server works internally with thread locals as well as thread local stacks. It is important that all created AppContext
objects are released to make sure the correct thread local objects are available.
Example: ApplicationContext Creation and Release
Application application = ...; try(ApplicationContext applicationContext = application.forceApplicationContext()) { // code, that executes Intershop code artifacts or business objects ... }
The lifecyles of applications, application types and application contexts are different. This means that the ApplicationContext
objects are created for each time an application is executed, e.g., during a single web request. The application types are created during the startup of the application server and exist as long as the application server runs. Application objects are persistent objects that can be created and removed at runtime and their dynamic states can survive a restart of an application server.
There is an interface ApplicationLifecycleListener
that can be used to create additional persistent objects during application creation (e.g., domains for particular business features) or clean up the same data during the removal of an application.
The configuration framework supports the configuration with the scope application
. The application also provides a method to get its configuration directly:
Application application = ...; Configuration configuration = application.getConfiguration(); String value = configuration.getString("intershop.aPropertyKey");
Lookup Order of Configuration Values
The configuration framework supports application preferences similar to domain preferences. The preferences are retrieved from the configuration system.
Application-specific configurations are built from the configurations of the site, the application type and the related cartridges. The corresponding files are located in IS_SHARE/system/config/<apps|cartridges|domains>.
See also Concept - Configuration.
Normally, applications are web applications rendering HTML web pages for the browser of business users. The browser communicates with the web server containing the WebAdapter, which is responsible (among other things) for mapping the web requests to particular servlets of the application server in a given application server group. This section describes the different types of URLs related to applications.
Pipelines with ending ISML Interaction Nodes are used to build HTML pages that are delivered to the browser of business users. They consist of the following parts: <protocol>://<host>:<port>/<prefix>/web/<server group>/<site>/<locale>/<application>/<currency>/<pipeline>-<start node>
.
<protocol>
: "http" or "https"<host>
: The host of the web server<port>
: The port of the web server<prefix>
: Value of the system-wide configuration "intershop.urlmapping.urlPrefix
" in fileIS_SHARE/system/config/cluster/appserver.properties
. Default:/INTERSHOP
"web
": Pipelines are executed by theRequestHandlerServlet
, which is mapped to the string "web" in the URL.<server group>
: The Intershop cluster can consist of several application servers. These application servers can be assigned to a group, e.g.WFS
,BOS
,JOB
.<site>
: The name of site, e.g. SMC.<locale>
: The identifier of the locale. A "-" references the default locale of application, e.g., "en_US".<application>
: The URL identifier of the application. A "-" references the default application of the site, e.g., "webshop".<currency>
: The code of the current currency. A "-" references the default currency of the application.<pipeline>
: The name of the pipeline which should be executed.<start node>
: The name of the start node within the pipeline to be called.
CSS, JavaScript files, images and other static content is delivered through the ResourceServlet
. The corresponding URL looks like this: <protocol>://<host>:<port>/<prefix>/static/<server group>/<site>/<application>/<unit>/<locale>/<path>
.
<protocol>
: "http" or "https"<host>
: The host of the web server<port>
: The port of the web server<prefix>
: Value of the system-wide configuration "intershop.urlmapping.urlPrefix
" in fileIS_SHARE/system/config/cluster/appserver.properties
. Default:/INTERSHOP
"static
": Static content is delivered through theResourceServlet
which is mapped to the string "static" in the URL.<server group>
: The Intershop cluster can consist of several application servers. These application servers can be assigned to a group, e.g.,WFS
,BOS
,JOB
.<site>
: The name of site, e.g., "inSPIRED-inTRONICS-Site".<application>
: The URL identifier of application. A "-" references the default application of site, e.g., "webshop".<unit>
: The name of the unit, e.g., "inSPIRED-inTRONICS". A "-" references the site itself.<locale>
: The identifier of a locale. A "-" references the default locale of application, e.g., "en_US".<path>
: The relative path to the static file.
The given relative path is used by the lookup strategy for the requested resource, which works in this way:
Search for resource in static content directory of:
Within each of the above-listed steps there is an additional fallback strategy depending on the locale:
Some applications provide a REST API. Corresponding URLs are described in the Concept - REST Framework.
The rule sets of URL rewriting functionality are application-specific. This means that there is a possibility to specify combined rule sets defined in the selected cartridges of an application. The mappings of host names to particular sites with according applications are made in the global configuration file: IS_SHARE/system/config/cluster/urlrewrite.properties. This file contains further information about the usage of the feature.
The standard applications of Intershop 7 use business objects, see Concept - Business Objects, to implement the business logic. The application framework provides two central APIs to integrate these business objects.
ApplicationBO
The business objects of an application can be accessed via the ApplicationBO
, which is automatically created during application context creation as long as the application type references the cartridge bc_application. The pipelet GetApplicationBO
is used to access this object within a pipeline. Internally, each application context also creates a business object context forcing the correct business object extension for particular application.
Note
Business Objects are only valid in correct ApplicationContext
The business objects work only correctly in their BusinessObjectContext
, which is generated during the creation of the application context.
Do not transfer business objects between two different ApplicationContexts!- Especially, if the pipelet ExecutePipeline
is used to call a pipeline of another application.
RepositoryBO
The RepositoryBO
provides a business API for managing business objects of one or more types. For instance, the RepositoryBO
inSPIRED-inTRONICS contains products, catalogs, promotions and other business objects. It is introduced to reuse business features in different business scenarios. Internally, the implementation AbstractDomainRepositoryBOExtensionFactory
of the RepositoryBO
maps to exactly one Domain
.
The repositories of the business objects are accessed using the Java method ApplicationBO.getRepository(String extensionID)
. This method internally searches for the extension factory of type AbstractDomainRepositoryBOExtensionFactory
with a given extension identifier. The factory found implements the method getRelationName()
to map the extension identifier to the name of an ApplicationDomainRelation
. Normally, it is the same. The resulting domain or domains contain(s) the corresponding business data. The following code snippet can be used to look for a product with a given identifier:
ApplicationBO applicationBO = ...; ProductBORepository repository = applicationBO.getRepository(ProductBORepository.EXTENSION_ID); ProductBO promotionBO = repository.getProductBOByID(id);
The implementation of the product repository simply needs to derive from AbstractDomainRepositoryBOExtensionFactory
. This pattern makes sure that every business feature is accessed in the same way, which significantly simplifies the business API of an application. The following figure shows the relations between the ApplicationBO
, RepositoryBO
, Domain
as well as particular business object repository:
In this example there are two business object contexts that are created for each application. All business objects use this context to determine their extensions. The implementation of the business objects use the persistent layer (ORM engine) where its objects are shared through all applications.
RepositoryBO
vs. Repository(PO)
The RepositoryBO
is introduced with Intershop 7 to provide a business API for data containers. The Repository
is a concept of former Enfinity releases. Technically, both concepts do not have anything to do with each other, but both work with domains. Repositories
will be deprecated in the near future.