}
private static void determineApplicableImplementationPolicySets(Component component) throws PolicyConfigurationException {
List<Intent> intentsCopy = null;
if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
//trim intents specified in operations. First check for policysets specified on the operation
//and then in the parent implementation
if ( component instanceof OperationsConfigurator ) {
OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
intentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
trimInherentlyProvidedIntents(policiedImplementation.getType(),
confOp.getRequiredIntents());
trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
trimProvidedIntents(confOp.getRequiredIntents(), component.getPolicySets());
determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
confOp,
policiedImplementation.getType());
if (confOp.getRequiredIntents().size() > 0) {
throw new PolicyConfigurationException("The following are unfulfilled intents for operations configured in "
+ "component implementation - " + component.getName() + "\nUnfulfilled Intents = " +
confOp.getRequiredIntents());
}
//the intents list could have been trimmed when matching for policysets
//since the implementation may need the original set of intents we copy that back
confOp.getRequiredIntents().clear();
confOp.getRequiredIntents().addAll(intentsCopy);
}
}
intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
trimInherentlyProvidedIntents(policiedImplementation.getType(),
component.getRequiredIntents());
trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
//determine additional policysets that match remaining intents
//if there are intents that are not provided by any policy set throw a warning
//TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
//...for now using the SCA Definitions instead of registry
//if ( domainPolicySets != null) {
determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
component,
policiedImplementation.getType());
if (component.getRequiredIntents().size() > 0) {
throw new PolicyConfigurationException("The following are unfulfilled intents for component implementation - " + component
.getName() + "\nUnfulfilled Intents = " + component.getRequiredIntents());
}