本文整理汇总了Java中com.alibaba.dubbo.registry.common.route.OverrideUtils类的典型用法代码示例。如果您正苦于以下问题:Java OverrideUtils类的具体用法?Java OverrideUtils怎么用?Java OverrideUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OverrideUtils类属于com.alibaba.dubbo.registry.common.route包,在下文中一共展示了OverrideUtils类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入依赖的package包/类
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);
}
示例2: show
import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入依赖的package包/类
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());
}
示例3: show
import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入依赖的package包/类
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);
}
示例4: show
import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入依赖的package包/类
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());
}
示例5: index
import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入依赖的package包/类
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);
}