// Javadoc inherited.
protected ActivatedPolicy activateImpl(
RuntimeProject actualProject, PolicyBuilder policyBuilder,
RuntimeProject logicalProject) {
VariablePolicyBuilder variablePolicyBuilder =
(VariablePolicyBuilder) policyBuilder;
// Ensure we prune any invalid variants before we start activating.
// We must do it now as the activation process will trigger lots
// of redundant(!) validation which will fail otherwise.
// TODO: avoid rendundant validation and consequent...
// TODO: avoid redundant logging of warnings
InternalVariablePolicyBuilder internalVariablePolicyBuilder =
(InternalVariablePolicyBuilder) variablePolicyBuilder;
internalVariablePolicyBuilder.validateAndPrune();
MarinerURL baseURL = getBaseURL(actualProject, policyBuilder,
logicalProject);
activateAlternateReferences(logicalProject, variablePolicyBuilder,
baseURL);
StyleSheetActivator styleSheetActivator =
new StyleSheetActivatorImpl(logicalProject, baseURL);
List variantBuilders = variablePolicyBuilder.getVariantBuilders();
for (int i = 0; i < variantBuilders.size(); i++) {
VariantBuilder variantBuilder = (VariantBuilder)
variantBuilders.get(i);
InternalLayoutContentBuilder layoutContentBuilder =
(InternalLayoutContentBuilder)
variantBuilder.getContentBuilder();
// Convert the content builder back into a content. This will
// trigger a partial validation of the policy with consequent
// redundant logging.
InternalLayoutContent layout = layoutContentBuilder
.getInternalLayoutContent();
final ActivatedLayoutContent activated =
contentActivator.activateLayoutContent(
styleSheetActivator, layout);
variantBuilder.setContentBuilder(new FixedContentBuilder(
activated));
}
// Convert the builder back into a policy. This will trigger another
// full validation with consequent redundant logging.
ActivatedVariablePolicy activatedVariablePolicy =
new ActivatedVariablePolicyImpl(
variablePolicyBuilder.getVariablePolicy(),
actualProject, logicalProject);
return activatedVariablePolicy;
}