This document is valid from 184.108.40.206.
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.
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.
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.
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.
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
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.