@Override public int hashCode() { int hashCode = 17; if (getName() != null) { hashCode *= 31 * getName().hashCode(); } if (getRole() != null) { hashCode *= 31 * getRole().hashCode(); } if (getVersion() != null) { hashCode *= 31 * getVersion().hashCode(); } return hashCode; }
public void setParamsList( Collection<Param> params ) { if( params != null ) { for( Param param : params ) { addParam( param ); } } }
@Override public Map<String, String> getParams() { return super.getParams(); }
public ServiceTest( Service s, String requestURL) { this.serviceName = s.getRole(); this.requestURL = requestURL; }
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 org.apache.knox.gateway.topology.Service getService(Service service) { org.apache.knox.gateway.topology.Service deploymentService = new org.apache.knox.gateway.topology.Service(); deploymentService.setRole(service.getRole()); deploymentService.setName(service.getName()); if (service.getVersion() != null) { deploymentService.setVersion(new Version(service.getVersion())); } for ( Param param : service.getParams() ) { deploymentService.addParam( getParam(param) ); } for ( String url : service.getUrls() ) { deploymentService.addUrl( url ); } return deploymentService; }
@Override public List<String> getUrls() { return super.getUrls(); }
@Override public String getName() { return super.getName(); }
@Override public Version getVersion() { return super.getVersion(); }
@Override public void addUrl(String url) { super.addUrl(url); }
@Override public void setName(String name) { super.setName(name); }
@Override public String getRole() { return super.getRole(); }
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 ); } } } } }
@Override public List<String> getUrls() { return super.getUrls(); }
@Override public String getName() { return super.getName(); }
@Override public Version getVersion() { return super.getVersion(); }