New to 4.0, Advanced Components can be extended to:
Component and Sub-Components
The purpose of an Evaluation is to dynamically alter a Sub-Component based on the current request. This is done by either changing the web script URL, updating the properties passed to the web script or preventing the Sub-Component from rendering entirely (which is demonstrated in the Hide Content on an Existing Alfresco Share Page tutorial).
A Sub-Component should be defined with a default web script URL and properties which will be used if no evaluations are configured or none of the evaluations that are configured evaluate successfully. If more than one evaluation is defined, then each will be processed in turn and the first to evaluate successfully will have the opportunity to override the web script URL and/or properties or to hide the Sub-Component.
Evaluations are processed in the order in which they are defined in the configuration file. Evaluations defined in extension modules are processed before evaluations in the “base” Component configuration. If more than one extension module defines evaluations for the same Sub-Component then they processed in the deployment order defined through the Module Deployment UI (/service/page/modules/deploy).
Alfresco uses Evaluations internally to update add, hide, and change various Sub-Components in the Document Library page, depending on what type of site is being viewed.
Every Sub-Component Evaluator must be configured in the Spring application context as a bean and must implement the org.springframework.extensions.surf.extensibility.SubComponentEvaluator interface. The interface defines a single method called evaluate that takes an org.springframework.extensions.surf.RequestContext and a parameter map as arguments.
A Sub-Component Evaluation will call the evaluate method on each Evaluator that is configured with and will only be considered to have evaluated successfully if every evaluate method returns True.
A number of SubComponentEvaluator instances are already configured in the Alfresco Share application context for testing various criteria (such as whether or not the requested page relates to a particular site) but it is a fairly simple exercise to create your own instances.
The RequestContext instance passed into the evaluate method will let you access pretty much everything you need to know about the request being evaluated (there's too much information to list, the best way to see everything available would be to attach a Java debugger to the web server and set a break point in an evaluator an inspect an instance).
Extensions and Modules
Extension Modules allow web scripts to replace or extend from Sub-Components.