Java Code Examples for com.alibaba.dubbo.registry.common.route.OverrideUtils

The following examples show how to use com.alibaba.dubbo.registry.common.route.OverrideUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: dubbox   Source File: Providers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
     Provider provider = providerService.findProvider(id);
     if (provider != null && provider.isDynamic()) {
List<Override> overrides = overrideService.findByServiceAndAddress(provider.getService(), provider.getAddress());
      OverrideUtils.setProviderOverrides(provider, overrides);
     }
     context.put("provider", provider);
 }
 
Example 2
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	Consumer consumer = consumerService.findConsumer(id);
	List<Provider> providers = providerService.findByService(consumer.getService());
	List<Route> routes = routeService.findByService(consumer.getService());
	List<Override> overrides = overrideService.findByService(consumer.getService());
	List<Route> routed = new ArrayList<Route>();
    consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
	consumer.setRoutes(routed);
	OverrideUtils.setConsumerOverrides(consumer, overrides);
	context.put("consumer", consumer);
	context.put("providers", consumer.getProviders());
	context.put("routes", consumer.getRoutes());
	context.put("overrides", consumer.getOverrides());
}
 
Example 3
Source Project: dubbox-hystrix   Source File: Providers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
     Provider provider = providerService.findProvider(id);
     if (provider != null && provider.isDynamic()) {
List<Override> overrides = overrideService.findByServiceAndAddress(provider.getService(), provider.getAddress());
      OverrideUtils.setProviderOverrides(provider, overrides);
     }
     context.put("provider", provider);
 }
 
Example 4
Source Project: dubbox-hystrix   Source File: Consumers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	Consumer consumer = consumerService.findConsumer(id);
	List<Provider> providers = providerService.findByService(consumer.getService());
	List<Route> routes = routeService.findByService(consumer.getService());
	List<Override> overrides = overrideService.findByService(consumer.getService());
	List<Route> routed = new ArrayList<Route>();
    consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
	consumer.setRoutes(routed);
	OverrideUtils.setConsumerOverrides(consumer, overrides);
	context.put("consumer", consumer);
	context.put("providers", consumer.getProviders());
	context.put("routes", consumer.getRoutes());
	context.put("overrides", consumer.getOverrides());
}
 
Example 5
Source Project: dubbo3   Source File: Providers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
     Provider provider = providerService.findProvider(id);
     if (provider != null && provider.isDynamic()) {
List<Override> overrides = overrideService.findByServiceAndAddress(provider.getService(), provider.getAddress());
      OverrideUtils.setProviderOverrides(provider, overrides);
     }
     context.put("provider", provider);
 }
 
Example 6
Source Project: dubbo3   Source File: Consumers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	Consumer consumer = consumerService.findConsumer(id);
	List<Provider> providers = providerService.findByService(consumer.getService());
	List<Route> routes = routeService.findByService(consumer.getService());
	List<Override> overrides = overrideService.findByService(consumer.getService());
	List<Route> routed = new ArrayList<Route>();
    consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
	consumer.setRoutes(routed);
	OverrideUtils.setConsumerOverrides(consumer, overrides);
	context.put("consumer", consumer);
	context.put("providers", consumer.getProviders());
	context.put("routes", consumer.getRoutes());
	context.put("overrides", consumer.getOverrides());
}
 
Example 7
Source Project: dubbox   Source File: Providers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
     Provider provider = providerService.findProvider(id);
     if (provider != null && provider.isDynamic()) {
List<Override> overrides = overrideService.findByServiceAndAddress(provider.getService(), provider.getAddress());
      OverrideUtils.setProviderOverrides(provider, overrides);
     }
     context.put("provider", provider);
 }
 
Example 8
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	Consumer consumer = consumerService.findConsumer(id);
	List<Provider> providers = providerService.findByService(consumer.getService());
	List<Route> routes = routeService.findByService(consumer.getService());
	List<Override> overrides = overrideService.findByService(consumer.getService());
	List<Route> routed = new ArrayList<Route>();
    consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
	consumer.setRoutes(routed);
	OverrideUtils.setConsumerOverrides(consumer, overrides);
	context.put("consumer", consumer);
	context.put("providers", consumer.getProviders());
	context.put("routes", consumer.getRoutes());
	context.put("overrides", consumer.getOverrides());
}
 
Example 9
Source Project: dubbox   Source File: Providers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
     Provider provider = providerService.findProvider(id);
     if (provider != null && provider.isDynamic()) {
List<Override> overrides = overrideService.findByServiceAndAddress(provider.getService(), provider.getAddress());
      OverrideUtils.setProviderOverrides(provider, overrides);
     }
     context.put("provider", provider);
 }
 
Example 10
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 5 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	Consumer consumer = consumerService.findConsumer(id);
	List<Provider> providers = providerService.findByService(consumer.getService());
	List<Route> routes = routeService.findByService(consumer.getService());
	List<Override> overrides = overrideService.findByService(consumer.getService());
	List<Route> routed = new ArrayList<Route>();
    consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
	consumer.setRoutes(routed);
	OverrideUtils.setConsumerOverrides(consumer, overrides);
	context.put("consumer", consumer);
	context.put("providers", consumer.getProviders());
	context.put("routes", consumer.getRoutes());
	context.put("overrides", consumer.getOverrides());
}
 
Example 11
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 4 votes vote down vote up
public void index(Map<String, Object> context) throws Exception {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Consumer> consumers;
    List<Override> overrides;
    List<Provider> providers = null;
	List<Route> routes = null;
    // service
    if (service != null && service.length() > 0) {
        consumers = consumerService.findByService(service);
        overrides = overrideService.findByService(service);
        providers = providerService.findByService(service);
    	routes = routeService.findByService(service);
    }
    // address
    else if (address != null && address.length() > 0) {
        consumers = consumerService.findByAddress(address);
        overrides = overrideService.findByAddress(Tool.getIP(address));
    }
    // application
    else if (application != null && application.length() > 0) {
        consumers = consumerService.findByApplication(application);
        overrides = overrideService.findByApplication(application);
    }
    // all
    else {
        consumers = consumerService.findAll();
        overrides = overrideService.findAll();
    }
    if (consumers != null && consumers.size() > 0) {
        for (Consumer consumer : consumers) {
        	if (service == null || service.length() == 0) {
        		providers = providerService.findByService(consumer.getService());
        		routes = routeService.findByService(consumer.getService());
        	}
            List<Route> routed = new ArrayList<Route>();
            consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
        	consumer.setRoutes(routed);
        	OverrideUtils.setConsumerOverrides(consumer, overrides);
        }
    }
    context.put("consumers", consumers);
}
 
Example 12
Source Project: dubbox-hystrix   Source File: Consumers.java    License: Apache License 2.0 4 votes vote down vote up
public void index(Map<String, Object> context) throws Exception {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Consumer> consumers;
    List<Override> overrides;
    List<Provider> providers = null;
	List<Route> routes = null;
    // service
    if (service != null && service.length() > 0) {
        consumers = consumerService.findByService(service);
        overrides = overrideService.findByService(service);
        providers = providerService.findByService(service);
    	routes = routeService.findByService(service);
    }
    // address
    else if (address != null && address.length() > 0) {
        consumers = consumerService.findByAddress(address);
        overrides = overrideService.findByAddress(Tool.getIP(address));
    }
    // application
    else if (application != null && application.length() > 0) {
        consumers = consumerService.findByApplication(application);
        overrides = overrideService.findByApplication(application);
    }
    // all
    else {
        consumers = consumerService.findAll();
        overrides = overrideService.findAll();
    }
    if (consumers != null && consumers.size() > 0) {
        for (Consumer consumer : consumers) {
        	if (service == null || service.length() == 0) {
        		providers = providerService.findByService(consumer.getService());
        		routes = routeService.findByService(consumer.getService());
        	}
            List<Route> routed = new ArrayList<Route>();
            consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
        	consumer.setRoutes(routed);
        	OverrideUtils.setConsumerOverrides(consumer, overrides);
        }
    }
    context.put("consumers", consumers);
}
 
Example 13
Source Project: dubbo3   Source File: Consumers.java    License: Apache License 2.0 4 votes vote down vote up
public void index(Map<String, Object> context) throws Exception {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Consumer> consumers;
    List<Override> overrides;
    List<Provider> providers = null;
	List<Route> routes = null;
    // service
    if (service != null && service.length() > 0) {
        consumers = consumerService.findByService(service);
        overrides = overrideService.findByService(service);
        providers = providerService.findByService(service);
    	routes = routeService.findByService(service);
    }
    // address
    else if (address != null && address.length() > 0) {
        consumers = consumerService.findByAddress(address);
        overrides = overrideService.findByAddress(Tool.getIP(address));
    }
    // application
    else if (application != null && application.length() > 0) {
        consumers = consumerService.findByApplication(application);
        overrides = overrideService.findByApplication(application);
    }
    // all
    else {
        consumers = consumerService.findAll();
        overrides = overrideService.findAll();
    }
    if (consumers != null && consumers.size() > 0) {
        for (Consumer consumer : consumers) {
        	if (service == null || service.length() == 0) {
        		providers = providerService.findByService(consumer.getService());
        		routes = routeService.findByService(consumer.getService());
        	}
            List<Route> routed = new ArrayList<Route>();
            consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
        	consumer.setRoutes(routed);
        	OverrideUtils.setConsumerOverrides(consumer, overrides);
        }
    }
    context.put("consumers", consumers);
}
 
Example 14
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 4 votes vote down vote up
public void index(Map<String, Object> context) throws Exception {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Consumer> consumers;
    List<Override> overrides;
    List<Provider> providers = null;
	List<Route> routes = null;
    // service
    if (service != null && service.length() > 0) {
        consumers = consumerService.findByService(service);
        overrides = overrideService.findByService(service);
        providers = providerService.findByService(service);
    	routes = routeService.findByService(service);
    }
    // address
    else if (address != null && address.length() > 0) {
        consumers = consumerService.findByAddress(address);
        overrides = overrideService.findByAddress(Tool.getIP(address));
    }
    // application
    else if (application != null && application.length() > 0) {
        consumers = consumerService.findByApplication(application);
        overrides = overrideService.findByApplication(application);
    }
    // all
    else {
        consumers = consumerService.findAll();
        overrides = overrideService.findAll();
    }
    if (consumers != null && consumers.size() > 0) {
        for (Consumer consumer : consumers) {
        	if (service == null || service.length() == 0) {
        		providers = providerService.findByService(consumer.getService());
        		routes = routeService.findByService(consumer.getService());
        	}
            List<Route> routed = new ArrayList<Route>();
            consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
        	consumer.setRoutes(routed);
        	OverrideUtils.setConsumerOverrides(consumer, overrides);
        }
    }
    context.put("consumers", consumers);
}
 
Example 15
Source Project: dubbox   Source File: Consumers.java    License: Apache License 2.0 4 votes vote down vote up
public void index(Map<String, Object> context) throws Exception {
    String service = (String) context.get("service");
    String application = (String) context.get("application");
    String address = (String) context.get("address");
    List<Consumer> consumers;
    List<Override> overrides;
    List<Provider> providers = null;
	List<Route> routes = null;
    // service
    if (service != null && service.length() > 0) {
        consumers = consumerService.findByService(service);
        overrides = overrideService.findByService(service);
        providers = providerService.findByService(service);
    	routes = routeService.findByService(service);
    }
    // address
    else if (address != null && address.length() > 0) {
        consumers = consumerService.findByAddress(address);
        overrides = overrideService.findByAddress(Tool.getIP(address));
    }
    // application
    else if (application != null && application.length() > 0) {
        consumers = consumerService.findByApplication(application);
        overrides = overrideService.findByApplication(application);
    }
    // all
    else {
        consumers = consumerService.findAll();
        overrides = overrideService.findAll();
    }
    if (consumers != null && consumers.size() > 0) {
        for (Consumer consumer : consumers) {
        	if (service == null || service.length() == 0) {
        		providers = providerService.findByService(consumer.getService());
        		routes = routeService.findByService(consumer.getService());
        	}
            List<Route> routed = new ArrayList<Route>();
            consumer.setProviders(RouteUtils.route(consumer.getService(), consumer.getAddress(), consumer.getParameters(), providers, overrides, routes, null, routed));
        	consumer.setRoutes(routed);
        	OverrideUtils.setConsumerOverrides(consumer, overrides);
        }
    }
    context.put("consumers", consumers);
}