Concept - Features Framework

Introduction

Info

This document is valid from 7.10.26.0.

For most circumstances injecting a dependency using Google Guice will fulfill all requirements. However, when it is necessary to select a concrete implementation by context (containing certain values) plain Guice will not help. The features framework fills this gap. A feature implementation is selected by its type and the actual context at runtime.

Additionally the features framework allows to customize/extends standard functionality which is also addressed by Java extension points. But the features framework integrate with Guice and is therefore easier to use.

References

Overview

The following class diagram visualizes the main components and their dependencies:

The key component is the class com.intershop.beehive.core.internal.feature.FeatureProviderImpl. It is bound to the global and the application type specific Guice object graph to have access to features and local (application-type-specific) features.

The FeatureProvider#getFeature-methods do the actual feature lookup by executing the isApplicable-method of the bound features. In prior the features are sorted by the @javax.annotation.Priority annotation. This priority sorting allows custom feature implementations to overrule ICM standard implementations because the feature with the highest priority is returned by the lookup.

Additionally, local features overrule global features. So an application-type-specific (local) feature implementation can replace a global feature implementation.

The Feature#getFeature(Class<S>, T)-method is designed to be a factory method and is therefore executed as last step during the lookup. A feature implementation may overwrite this default implementation if the actual feature is implemented by another class.

Example

The following diagram shows example feature implementations:

Both implementations implement the same business interface which defines the business API of the feature. The GlobalImplementation implements the Feature interface and has to be bound to the global object graph. The LocalImplementation implements the LocalFeature interface and has to be bound to the (local) application type specific object graph. The feature implementations may overwrite the default isApplicable-method, whose conditions (e.g. value-content) have to be fulfilled to choose this particular implementation. For example, the feature lookup is executed using FeatureProvider#getFeature(BusinessInterface.class, value) which returns an instance of BusinessInterface that can be used afterwards to execute doSomething(input).

Disclaimer
The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.
The Intershop Knowledge Portal uses only technically necessary cookies. We do not track visitors or have visitors tracked by 3rd parties. Please find further information on privacy in the Intershop Privacy Policy and Legal Notice.
Home
Knowledge Base
Product Releases
Log on to continue
This Knowledge Base document is reserved for registered customers.
Log on with your Intershop Entra ID to continue.
Write an email to supportadmin@intershop.de if you experience login issues,
or if you want to register as customer.