@Override public List<String> getUrls() { return super.getUrls(); }
@Override public List<String> getUrls() { return super.getUrls(); }
public void addUrl( String url) { getUrls().add( url ); }
public void addUrl( String url) { getUrls().add( url ); }
private static Service getService( org.apache.knox.gateway.topology.Service service) { Service serviceResource = new Service(); serviceResource.setRole(service.getRole()); serviceResource.setName(service.getName()); Version version = service.getVersion(); if (version != null) { serviceResource.setVersion(version.toString()); } Collection<org.apache.knox.gateway.topology.Param> paramsList = service.getParamsList(); if (paramsList != null && !paramsList.isEmpty()) { for ( org.apache.knox.gateway.topology.Param param : paramsList ) { serviceResource.getParams().add(getParam(param)); } } for ( String url : service.getUrls() ) { serviceResource.getUrls().add( url ); } return serviceResource; }
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 ); } } } } }