private static void contributeServices( DeploymentContext context, Topology topology, Map<String, List<ServiceDeploymentContributor>> services ) { if( services != null ) { for( Service service : topology.getServices() ) { ServiceDeploymentContributor contributor = getServiceContributor( service.getRole(), service.getName(), service.getVersion() ); if( contributor != null ) { try { log.contributeService( service.getName(), service.getRole() ); contributor.contributeService( context, service ); if( gatewayServices != null ) { ServiceRegistry sr = gatewayServices.getService( GatewayServices.SERVICE_REGISTRY_SERVICE ); if( sr != null ) { String regCode = sr.getRegistrationCode( topology.getName() ); sr.registerService( regCode, topology.getName(), service.getRole(), service.getUrls() ); } } } catch( Exception e ) { // Maybe it makes sense to throw exception log.failedToContributeService( service.getName(), service.getRole(), e ); throw new DeploymentException( "Failed to contribute service.", e ); } } } } }
private static void contributeServices( DeploymentContext context, Topology topology, Map<String, List<ServiceDeploymentContributor>> services ) { if( services != null ) { for( Service service : topology.getServices() ) { ServiceDeploymentContributor contributor = getServiceContributor( service.getRole(), service.getName(), service.getVersion() ); if( contributor != null ) { try { log.contributeService( service.getName(), service.getRole() ); contributor.contributeService( context, service ); if( gatewayServices != null ) { ServiceRegistry sr = gatewayServices.getService( GatewayServices.SERVICE_REGISTRY_SERVICE ); if( sr != null ) { String regCode = sr.getRegistrationCode( topology.getName() ); sr.registerService( regCode, topology.getName(), service.getRole(), service.getUrls() ); } } } catch( Exception e ) { // Maybe it makes sense to throw exception log.failedToContributeService( service.getName(), service.getRole(), e ); throw new DeploymentException( "Failed to contribute service.", e ); } } } } }