- // list.
- reallyRequired.removeAll(Arrays.asList(aRequired));
-
- String missingRequired = "";
- for (RequiredInterface service: reallyRequired) {
- missingRequired += service + "\n";
+ // list.
+ reallyRequired.removeAll(Arrays.asList(getRequiredInterfaces()));
+ return reallyRequired;
+ }
+
+ private void validateRequiredInterfaces(List<RequiredInterface> aRequired) {
+ for (RequiredInterface service : getRequiredInterfaces()) {
+ // TODO required interfaces by the component could be
+ // subclasses or implementations of the requirements
+ // of the contained components. The code below assumes
+ // an exact match.
+ if (!(aRequired.contains(service))) {
+ info("Service '"
+ + service
+ + "' indicated as required is not actually required by any of the components");
+ }
+ // Check for the case that the externally required service
+ // is optional whereas the internally required service is
+ // mandatory.
+ if ( service.isOptional()) {
+ for (RequiredInterface intf: aRequired) {
+ if ( intf.equals(service) && !intf.isOptional()) {
+ warn("Required service '" + service + "' indicated as optional is mandatory by one of its components (" + getClients(intf) + ", " + intf + "), this can lead to problems when the container is started and the interface is not provided to the container.");
+ }
+ }
+ }