+ private Pair<Component,ProvidedInterface> findProvidedInterface(ProvidedInterface aProvided) {
+ List<Pair<Component,ProvidedInterface>> result =
+ new ArrayList<Pair<Component,ProvidedInterface>>();
+ for (Component component: _components) {
+ for (ProvidedInterface provided: component.getProvidedInterfaces()) {
+ if ( aProvided.equals(provided) ) {
+ result.add(new Pair<Component,ProvidedInterface>(component, provided));
+ }
+ }
+ }
+ if ( result.size() == 0) {
+ throw new SystemAssemblyException(getQualifiedName() + ": Service '"
+ + aProvided
+ + "' is not provided by any of its components");
+ }
+ if ( result.size() > 1) {
+ throw new SystemAssemblyException(getQualifiedName() + ": Service '"
+ + aProvided
+ + "' is provided by multiple components: " + result);
+ }
+ return result.get(0);