buildPolicies(composite, context);
return composite;
}
protected void computePolicies(Composite composite, BuilderContext context) {
Monitor monitor = context.getMonitor();
monitor.pushContext("Composite: " + composite.getName().toString());
try {
resolveAndCheck(composite, context);
// compute policies recursively
for (Component component : composite.getComponents()) {
monitor.pushContext("Component: " + component.getName());
//resolve component level
resolveAndCheck(component, context);
try {
Implementation implementation = component.getImplementation();
for (ComponentService componentService : component.getServices()) {
monitor.pushContext("Service: " + componentService.getName());
try {
resolveAndCheck(componentService, context);
if (componentService.getInterfaceContract() != null) {
resolveAndCheck(componentService.getInterfaceContract().getInterface(), context);
resolveAndCheck(componentService.getInterfaceContract().getCallbackInterface(), context);
}
for (Endpoint ep : componentService.getEndpoints()) {
// Inherit from binding
inherit(ep, null, true, ep.getBinding());
// Inherit from composite/component/service
inherit(ep, null, true, ep.getService(), ep.getComponent(), composite );
if (componentService.getInterfaceContract() != null) {
// Inherit from the component.service.interface
// Do not check mutual exclusion here.. interfaces do not follow normal rules
// of the structural hierarchy (Policy spec 4.10)
inherit(ep, null, false, componentService.getInterfaceContract().getInterface());
}
// Replace profile intents with their required intents
// Replace unqualified intents if there is a qualified intent in the list
// Replace qualifiable intents with the default qualied intent
resolveAndNormalize(ep, context);
// Replace qualifiable intents with their default qualifier
expandDefaultIntents(ep, context);
// Remove the intents whose @contraints do not include the current element
removeConstrainedIntents(ep, context);
// Remove any direct policy sets if an external one has been applied
removeDirectPolicySetsIfExternalExists(ep, context);
// Validate that noListener is not specified on a service endpoint
checkForNoListenerIntent(ep, context);
// check that all intents are resolved
checkIntentsResolved(ep, context);
// check that the resulting endpoint has no mutually exclusive intents
checkMutualExclusion(ep, context);
}
} finally {
monitor.popContext();
}
}
for (ComponentReference componentReference : component.getReferences()) {
monitor.pushContext("Reference: " + componentReference.getName().toString());
try {
if (componentReference.getInterfaceContract() != null) {
resolveAndCheck(componentReference.getInterfaceContract().getInterface(), context);
resolveAndCheck(componentReference.getInterfaceContract().getCallbackInterface(),
context);
}
for (EndpointReference epr : componentReference.getEndpointReferences()) {
// Inherit from binding
inherit(epr, null, true, epr.getBinding());
// Inherit from composite/component/reference
inherit(epr, null, true, epr.getReference(), epr.getComponent(), composite);
// Inherit from the component.reference.interface
if (componentReference.getInterfaceContract() != null) {
// Do not check mutual exclusion here.. interfaces do not follow normal rules
// of the structural hierarchy (Policy spec 4.10)
inherit(epr, null, true, componentReference.getInterfaceContract().getInterface());
}
// Replace profile intents with their required intents
// Replace unqualified intents if there is a qualified intent in the list
// Replace qualifiable intents with the default qualified intent
resolveAndNormalize(epr, context);
// Replace qualifiable intents with their default qualifier
expandDefaultIntents(epr, context);
// Remove the intents whose @contraints do not include the current element
removeConstrainedIntents(epr, context);
removeDirectPolicySetsIfExternalExists(epr, context);
// check that all intents are resolved
checkIntentsResolved(epr, context);
// check that the resulting endpoint reference has no mutually exclusive intents
checkMutualExclusion(epr, context);
}
} finally {
monitor.popContext();
}
}
if (implementation instanceof Composite) {
resolveAndCheck(implementation, context);
inherit(implementation, Intent.Type.implementation, true, component, composite);
computePolicies((Composite)implementation, context);
expandDefaultIntents(implementation,context);
checkIntentsResolved(implementation,context);
} else {
resolveAndCheck(implementation, context);
if (implementation != null) {
inherit(implementation, Intent.Type.implementation, true, component, composite);
// Remove the intents whose @contraints do not include the current element
removeConstrainedIntents(implementation, context);
removeDirectPolicySetsIfExternalExists(implementation, context);
// Replace qualifiable intents with their default qualifier
expandDefaultIntents(implementation, context);
// check that all intents are resolved
checkIntentsResolved(implementation, context);
}
}
} finally {
monitor.popContext();
}
}
removeConstrainedIntents(composite, context);
} finally {
monitor.popContext();
}
}