com.alibaba.dubbo.registry.common.domain.LoadBalance Java Examples
The following examples show how to use
com.alibaba.dubbo.registry.common.domain.LoadBalance.
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 File: Loadbalances.java From dubbo3 with Apache License 2.0 | 5 votes |
public boolean update(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } overrideService.updateOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #2
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override loadBalanceToOverride(LoadBalance loadBalance){ Override override = new Override(); override.setId(loadBalance.getId()); override.setService(loadBalance.getService()); override.setEnabled(true); String method = loadBalance.getMethod(); String strategy = loadBalance.getStrategy(); if(StringUtils.isEmpty(method) ||method.equals("*")){ override.setParams("loadbalance=" + strategy); }else{ override.setParams(method + ".loadbalance=" + strategy); } return override; }
Example #3
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides){ List<LoadBalance> loadBalances = new ArrayList<LoadBalance>(); if(overrides == null){ return loadBalances; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().endsWith("loadbalance")){ LoadBalance loadBalance = new LoadBalance(); String method = null; if(entry.getKey().endsWith(".loadbalance")){ method = entry.getKey().split(".loadbalance")[0]; }else{ method = "*"; } loadBalance.setMethod(method); loadBalance.setId(o.getId()); loadBalance.setService(o.getService()); loadBalance.setStrategy(entry.getValue()); loadBalances.add(loadBalance); } } } } return loadBalances; }
Example #4
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } overrideService.updateOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #5
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean create(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } loadBalance.setUsername((String)context.get("operator")); overrideService.saveOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #6
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
Example #7
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override loadBalanceToOverride(LoadBalance loadBalance){ Override override = new Override(); override.setId(loadBalance.getId()); override.setService(loadBalance.getService()); override.setEnabled(true); String method = loadBalance.getMethod(); String strategy = loadBalance.getStrategy(); if(StringUtils.isEmpty(method) ||method.equals("*")){ override.setParams("loadbalance=" + strategy); }else{ override.setParams(method + ".loadbalance=" + strategy); } return override; }
Example #8
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides){ List<LoadBalance> loadBalances = new ArrayList<LoadBalance>(); if(overrides == null){ return loadBalances; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().endsWith("loadbalance")){ LoadBalance loadBalance = new LoadBalance(); String method = null; if(entry.getKey().endsWith(".loadbalance")){ method = entry.getKey().split(".loadbalance")[0]; }else{ method = "*"; } loadBalance.setMethod(method); loadBalance.setId(o.getId()); loadBalance.setService(o.getService()); loadBalance.setStrategy(entry.getValue()); loadBalances.add(loadBalance); } } } } return loadBalances; }
Example #9
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } overrideService.updateOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #10
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean create(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } loadBalance.setUsername((String)context.get("operator")); overrideService.saveOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #11
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
Example #12
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 5 votes |
public static Override loadBalanceToOverride(LoadBalance loadBalance){ Override override = new Override(); override.setId(loadBalance.getId()); override.setService(loadBalance.getService()); override.setEnabled(true); String method = loadBalance.getMethod(); String strategy = loadBalance.getStrategy(); if(StringUtils.isEmpty(method) ||method.equals("*")){ override.setParams("loadbalance=" + strategy); }else{ override.setParams(method + ".loadbalance=" + strategy); } return override; }
Example #13
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 5 votes |
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides){ List<LoadBalance> loadBalances = new ArrayList<LoadBalance>(); if(overrides == null){ return loadBalances; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().endsWith("loadbalance")){ LoadBalance loadBalance = new LoadBalance(); String method = null; if(entry.getKey().endsWith(".loadbalance")){ method = entry.getKey().split(".loadbalance")[0]; }else{ method = "*"; } loadBalance.setMethod(method); loadBalance.setId(o.getId()); loadBalance.setService(o.getService()); loadBalance.setStrategy(entry.getValue()); loadBalances.add(loadBalance); } } } } return loadBalances; }
Example #14
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
Example #15
Source File: Loadbalances.java From dubbo3 with Apache License 2.0 | 5 votes |
public boolean create(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } loadBalance.setUsername((String)context.get("operator")); overrideService.saveOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #16
Source File: Loadbalances.java From dubbo3 with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
Example #17
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean create(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } loadBalance.setUsername((String)context.get("operator")); overrideService.saveOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #18
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 5 votes |
public boolean update(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } overrideService.updateOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #19
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides){ List<LoadBalance> loadBalances = new ArrayList<LoadBalance>(); if(overrides == null){ return loadBalances; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().endsWith("loadbalance")){ LoadBalance loadBalance = new LoadBalance(); String method = null; if(entry.getKey().endsWith(".loadbalance")){ method = entry.getKey().split(".loadbalance")[0]; }else{ method = "*"; } loadBalance.setMethod(method); loadBalance.setId(o.getId()); loadBalance.setService(o.getService()); loadBalance.setStrategy(entry.getValue()); loadBalances.add(loadBalance); } } } } return loadBalances; }
Example #20
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 5 votes |
public static Override loadBalanceToOverride(LoadBalance loadBalance){ Override override = new Override(); override.setId(loadBalance.getId()); override.setService(loadBalance.getService()); override.setEnabled(true); String method = loadBalance.getMethod(); String strategy = loadBalance.getStrategy(); if(StringUtils.isEmpty(method) ||method.equals("*")){ override.setParams("loadbalance=" + strategy); }else{ override.setParams(method + ".loadbalance=" + strategy); } return override; }
Example #21
Source File: Loadbalances.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public void index(Map<String, Object> context) { final String service = StringUtils.trimToNull((String) context.get("service")); List<LoadBalance> loadbalances; if (service != null && service.length() > 0) { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findByService(service)); } else { loadbalances = OverrideUtils.overridesToLoadBalances(overrideService.findAll()); } context.put("loadbalances", loadbalances); }
Example #22
Source File: Loadbalances.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public boolean create(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } loadBalance.setUsername((String)context.get("operator")); overrideService.saveOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #23
Source File: Loadbalances.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public boolean update(LoadBalance loadBalance, Map<String, Object> context) { if (!super.currentUser.hasServicePrivilege(loadBalance.getService())) { context.put("message", getMessage("HaveNoServicePrivilege", loadBalance.getService())); return false; } overrideService.updateOverride(OverrideUtils.loadBalanceToOverride(loadBalance)); return true; }
Example #24
Source File: OverrideUtils.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public static List<LoadBalance> overridesToLoadBalances(List<Override> overrides){ List<LoadBalance> loadBalances = new ArrayList<LoadBalance>(); if(overrides == null){ return loadBalances; } for(Override o : overrides){ if(StringUtils.isEmpty(o.getParams())){ continue; }else{ Map<String,String> params = StringUtils.parseQueryString(o.getParams()); for(Map.Entry<String, String> entry : params.entrySet()){ if(entry.getKey().endsWith("loadbalance")){ LoadBalance loadBalance = new LoadBalance(); String method = null; if(entry.getKey().endsWith(".loadbalance")){ method = entry.getKey().split(".loadbalance")[0]; }else{ method = "*"; } loadBalance.setMethod(method); loadBalance.setId(o.getId()); loadBalance.setService(o.getService()); loadBalance.setStrategy(entry.getValue()); loadBalances.add(loadBalance); } } } } return loadBalances; }
Example #25
Source File: OverrideUtils.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public static Override loadBalanceToOverride(LoadBalance loadBalance){ Override override = new Override(); override.setId(loadBalance.getId()); override.setService(loadBalance.getService()); override.setEnabled(true); String method = loadBalance.getMethod(); String strategy = loadBalance.getStrategy(); if(StringUtils.isEmpty(method) ||method.equals("*")){ override.setParams("loadbalance=" + strategy); }else{ override.setParams(method + ".loadbalance=" + strategy); } return override; }
Example #26
Source File: Loadbalances.java From dubbox with Apache License 2.0 | 4 votes |
public void show(Long id, Map<String, Object> context) { LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id)); context.put("loadbalance", loadbalance); }
Example #27
Source File: Loadbalances.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public void show(Long id, Map<String, Object> context) { LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id)); context.put("loadbalance", loadbalance); }
Example #28
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 4 votes |
public static LoadBalance overrideToLoadBalance(Override override){ return OverrideUtils.overridesToLoadBalances(Arrays.asList(override)).get(0); }
Example #29
Source File: OverrideUtils.java From dubbo3 with Apache License 2.0 | 4 votes |
public static LoadBalance overrideToLoadBalance(Override override){ return OverrideUtils.overridesToLoadBalances(Arrays.asList(override)).get(0); }
Example #30
Source File: OverrideUtils.java From dubbox with Apache License 2.0 | 4 votes |
public static LoadBalance overrideToLoadBalance(Override override){ return OverrideUtils.overridesToLoadBalances(Arrays.asList(override)).get(0); }