private void validateAllServicesAvailable ( ) { // Firstly validate that all stages have satisfied service dependencies List < String > missingServices = new LinkedList <> ( ) ; for ( StageDefinition stage : stageList ) { for ( ServiceDependencyDefinition service : stage . getServices ( ) ) { if ( ! serviceMap . containsKey ( service . getService ( ) ) ) { missingServices . add ( Utils . format ( "Stage {} is missing service {}" , stage . getName ( ) , service . getService ( ) . getName ( ) ) ) ; } } } if ( ! missingServices . isEmpty ( ) ) { throw new RuntimeException ( "Missing services: " + StringUtils . join ( missingServices , ", " ) ) ; } // Secondly ensure that all loaded services are compatible with what is supported by our runtime engine List < String > unsupportedServices = new LinkedList <> ( ) ; for ( ServiceDefinition serviceDefinition : serviceList ) { if ( ! ServiceRuntime . supports ( serviceDefinition . getProvides ( ) ) ) { unsupportedServices . add ( serviceDefinition . getProvides ( ) . toString ( ) ) ; } } if ( ! unsupportedServices . isEmpty ( ) ) { throw new RuntimeException ( "Unsupported services: " + StringUtils . join ( unsupportedServices , ", " ) ) ; } }
Validate service dependencies .