com.alibaba.dubbo.registry.common.util.OverrideUtils Java Examples

The following examples show how to use com.alibaba.dubbo.registry.common.util.OverrideUtils. 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 vote down vote up
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 #2
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #3
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #4
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #5
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public boolean update(Weight weight, Map<String, Object> context) {
    if (!super.currentUser.hasServicePrivilege(weight.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
        return false;
    }
    weight.setAddress(Tool.getIP(weight.getAddress()));
	overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
    return true;
}
 
Example #6
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example #7
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #8
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #9
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #10
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public boolean update(Weight weight, Map<String, Object> context) {
    if (!super.currentUser.hasServicePrivilege(weight.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
        return false;
    }
    weight.setAddress(Tool.getIP(weight.getAddress()));
	overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
    return true;
}
 
Example #11
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example #12
Source File: Loadbalances.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
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 #13
Source File: Loadbalances.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
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 #14
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example #15
Source File: Weights.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public boolean update(Weight weight, Map<String, Object> context) {
    if (!super.currentUser.hasServicePrivilege(weight.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
        return false;
    }
    weight.setAddress(Tool.getIP(weight.getAddress()));
	overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
    return true;
}
 
Example #16
Source File: Weights.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example #17
Source File: Loadbalances.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
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 #18
Source File: Weights.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public boolean update(Weight weight, Map<String, Object> context) {
    if (!super.currentUser.hasServicePrivilege(weight.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
        return false;
    }
    weight.setAddress(Tool.getIP(weight.getAddress()));
	overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
    return true;
}
 
Example #19
Source File: Loadbalances.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
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 #20
Source File: Loadbalances.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
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 #21
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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: Weights.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public boolean update(Weight weight, Map<String, Object> context) {
    if (!super.currentUser.hasServicePrivilege(weight.getService())) {
        context.put("message", getMessage("HaveNoServicePrivilege", weight.getService()));
        return false;
    }
    weight.setAddress(Tool.getIP(weight.getAddress()));
	overrideService.updateOverride(OverrideUtils.weightToOverride(weight));
    return true;
}
 
Example #23
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #24
Source File: Weights.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public void index(Map<String, Object> context) {
    final String service = StringUtils.trimToNull((String) context.get("service"));
    String address = (String) context.get("address");
    address = Tool.getIP(address);
    List<Weight> weights;
    if (service != null && service.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByService(service));
    } else if (address != null && address.length() > 0) {
        weights = OverrideUtils.overridesToWeights(overrideService.findByAddress(address));
    } else {
        weights = OverrideUtils.overridesToWeights(overrideService.findAll());
    }
    context.put("weights", weights);
}
 
Example #25
Source File: Loadbalances.java    From dubbox with Apache License 2.0 5 votes vote down vote up
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 #26
Source File: Loadbalances.java    From dubbox with Apache License 2.0 4 votes vote down vote up
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 with Apache License 2.0 4 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id));
    context.put("loadbalance", loadbalance);
}
 
Example #28
Source File: Loadbalances.java    From dubbox with Apache License 2.0 4 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id));
    context.put("loadbalance", loadbalance);
}
 
Example #29
Source File: Loadbalances.java    From dubbox-hystrix with Apache License 2.0 4 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id));
    context.put("loadbalance", loadbalance);
}
 
Example #30
Source File: Loadbalances.java    From dubbo3 with Apache License 2.0 4 votes vote down vote up
public void show(Long id, Map<String, Object> context) {
	LoadBalance loadbalance = OverrideUtils.overrideToLoadBalance(overrideService.findById(id));
    context.put("loadbalance", loadbalance);
}