* in case of any validation problems.
*/
public void validate() {
- List<ProvidedInterface> provided = new ArrayList<ProvidedInterface>();
- for (Component component : _components) {
- provided.addAll(Arrays.asList(component.getProvidedInterfaces()));
- }
+ validateProvidedInterfacesArePresent();
+
+ validateRequiredInterfaces();
+ doStartOptionalDryRun(null, true);
+ }
+
+ private void validateRequiredInterfaces() {
List<RequiredInterface> required = new ArrayList<RequiredInterface>();
for (Component component : _components) {
required.addAll(Arrays.asList(component.getRequiredInterfaces()));
}
- validateProvidedInterfacesArePresent(provided);
-
- validateRequiredInterfaces(required);
-
- doStartOptionalDryRun(null, true);
- }
-
- 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))) {
+ if (!(required.contains(service))) {
info("Service '"
+ service
+ "' indicated as required is not actually required by any of the components");
// is optional whereas the internally required service is
// mandatory.
if (service.isOptional()) {
- for (RequiredInterface intf : aRequired) {
+ for (RequiredInterface intf : required) {
if (intf.equals(service) && !intf.isOptional()) {
warn("Required service '"
+ service
}
}
- private void validateProvidedInterfacesArePresent(
- List<ProvidedInterface> aProvided) {
+ private void validateProvidedInterfacesArePresent() {
+ List<ProvidedInterface> provided = new ArrayList<ProvidedInterface>();
+ for (Component component : _components) {
+ provided.addAll(Arrays.asList(component.getProvidedInterfaces()));
+ }
for (ProvidedInterface service : getProvidedInterfaces()) {
// TODO provided interfaces by components could be
// provide subclasses or implementations of the
// provided interfaces of the container.
// The code below assumes an exact match.
- if (!(aProvided.contains(service))) {
+ if (!(provided.contains(service))) {
throw new SystemAssemblyException(getName() + ": Service '"
+ service
+ "' is not provided by any of its components");