当前位置: 首页>>代码示例>>Java>>正文


Java OverrideUtils.setConsumerOverrides方法代码示例

本文整理汇总了Java中com.alibaba.dubbo.registry.common.route.OverrideUtils.setConsumerOverrides方法的典型用法代码示例。如果您正苦于以下问题:Java OverrideUtils.setConsumerOverrides方法的具体用法?Java OverrideUtils.setConsumerOverrides怎么用?Java OverrideUtils.setConsumerOverrides使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.dubbo.registry.common.route.OverrideUtils的用法示例。


在下文中一共展示了OverrideUtils.setConsumerOverrides方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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());
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:15,代码来源:Consumers.java

示例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());
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:15,代码来源:Consumers.java

示例3: 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);
}
 
开发者ID:dachengxi,项目名称:EatDubbo,代码行数:45,代码来源:Consumers.java

示例4: 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);
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:45,代码来源:Consumers.java

示例5: update

import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入方法依赖的package包/类
public boolean update(Consumer newConsumer, Map<String, Object> context) {
  	Long id = newConsumer.getId();
  	String parameters = newConsumer.getParameters();
  	Consumer consumer = consumerService.findConsumer(id);
if (consumer == null) {
	context.put("message", getMessage("NoSuchOperationData", id));
	return false;
}
      String service = consumer.getService();
      if (!super.currentUser.hasServicePrivilege(service)) {
          context.put("message", getMessage("HaveNoServicePrivilege", service));
          return false;
      }
      Map<String, String> oldMap = StringUtils.parseQueryString(consumer.getParameters());
      Map<String, String> newMap = StringUtils.parseQueryString(parameters);
      for (Map.Entry<String, String> entry : oldMap.entrySet()) {
      	if (entry.getValue().equals(newMap.get(entry.getKey()))) {
      		newMap.remove(entry.getKey());
      	}
      }
      String address = consumer.getAddress();
      List<Override> overrides = overrideService.findByServiceAndAddress(consumer.getService(), consumer.getAddress());
      OverrideUtils.setConsumerOverrides(consumer, overrides);
      Override override = consumer.getOverride();
      if (override != null) {
          if (newMap.size() > 0) {
          	override.setParams(StringUtils.toQueryString(newMap));
              override.setEnabled(true);
              override.setOperator(operator);
              override.setOperatorAddress(operatorAddress);
              overrideService.updateOverride(override);
          } else {
          	overrideService.deleteOverride(override.getId());
          }
      } else {
          override = new Override();
          override.setService(service);
          override.setAddress(address);
          override.setParams(StringUtils.toQueryString(newMap));
          override.setEnabled(true);
          override.setOperator(operator);
          override.setOperatorAddress(operatorAddress);
          overrideService.saveOverride(override);
      }
      return true;
  }
 
开发者ID:xingmima,项目名称:dubbos,代码行数:47,代码来源:Consumers.java

示例6: update

import com.alibaba.dubbo.registry.common.route.OverrideUtils; //导入方法依赖的package包/类
public boolean update(Consumer newConsumer, Map<String, Object> context) {
    Long id = newConsumer.getId();
    String parameters = newConsumer.getParameters();
    Consumer consumer = consumerService.findConsumer(id);
    if (consumer == null) {
        context.put("message", getMessage("NoSuchOperationData", id));
        return false;
    }
    String service = consumer.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    Map<String, String> oldMap = StringUtils.parseQueryString(consumer.getParameters());
    Map<String, String> newMap = StringUtils.parseQueryString(parameters);
    for (Map.Entry<String, String> entry : oldMap.entrySet()) {
        if (entry.getValue().equals(newMap.get(entry.getKey()))) {
            newMap.remove(entry.getKey());
        }
    }
    String address = consumer.getAddress();
    List<Override> overrides = overrideService.findByServiceAndAddress(consumer.getService(), consumer.getAddress());
    OverrideUtils.setConsumerOverrides(consumer, overrides);
    Override override = consumer.getOverride();
    if (override != null) {
        if (newMap.size() > 0) {
            override.setParams(StringUtils.toQueryString(newMap));
            override.setEnabled(true);
            override.setOperator(operator);
            override.setOperatorAddress(operatorAddress);
            overrideService.updateOverride(override);
        } else {
            overrideService.deleteOverride(override.getId());
        }
    } else {
        override = new Override();
        override.setService(service);
        override.setAddress(address);
        override.setParams(StringUtils.toQueryString(newMap));
        override.setEnabled(true);
        override.setOperator(operator);
        override.setOperatorAddress(operatorAddress);
        overrideService.saveOverride(override);
    }
    return true;
}
 
开发者ID:hufeng,项目名称:dubbo2.js,代码行数:47,代码来源:Consumers.java


注:本文中的com.alibaba.dubbo.registry.common.route.OverrideUtils.setConsumerOverrides方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。