Java Code Examples for com.alibaba.dubbo.registry.common.domain.Override#isMatch()

The following examples show how to use com.alibaba.dubbo.registry.common.domain.Override#isMatch() . 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: OverrideUtils.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public static void setConsumerOverrides(Consumer consumer, List<Override> overrides) {
	if (consumer == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(consumer)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(consumer)) {
   			consumer.setOverride(override);
   		}
   	}
	Collections.sort(result, OverrideUtils.OVERRIDE_COMPARATOR);
	consumer.setOverrides(result);
}
 
Example 2
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setProviderOverrides(Provider provider, List<Override> overrides) {
	if (provider == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(provider)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(provider)) {
   			provider.setOverride(override);
   		}
   	}
	provider.setOverrides(overrides);
}
 
Example 3
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setConsumerOverrides(Consumer consumer, List<Override> overrides) {
	if (consumer == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(consumer)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(consumer)) {
   			consumer.setOverride(override);
   		}
   	}
	Collections.sort(result, OverrideUtils.OVERRIDE_COMPARATOR);
	consumer.setOverrides(result);
}
 
Example 4
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setProviderOverrides(Provider provider, List<Override> overrides) {
	if (provider == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(provider)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(provider)) {
   			provider.setOverride(override);
   		}
   	}
	provider.setOverrides(overrides);
}
 
Example 5
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setConsumerOverrides(Consumer consumer, List<Override> overrides) {
	if (consumer == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(consumer)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(consumer)) {
   			consumer.setOverride(override);
   		}
   	}
	Collections.sort(result, OverrideUtils.OVERRIDE_COMPARATOR);
	consumer.setOverrides(result);
}
 
Example 6
Source File: OverrideUtils.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public static void setProviderOverrides(Provider provider, List<Override> overrides) {
	if (provider == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(provider)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(provider)) {
   			provider.setOverride(override);
   		}
   	}
	provider.setOverrides(overrides);
}
 
Example 7
Source File: OverrideUtils.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public static void setProviderOverrides(Provider provider, List<Override> overrides) {
	if (provider == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(provider)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(provider)) {
   			provider.setOverride(override);
   		}
   	}
	provider.setOverrides(overrides);
}
 
Example 8
Source File: OverrideUtils.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public static void setConsumerOverrides(Consumer consumer, List<Override> overrides) {
	if (consumer == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(consumer)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(consumer)) {
   			consumer.setOverride(override);
   		}
   	}
	Collections.sort(result, OverrideUtils.OVERRIDE_COMPARATOR);
	consumer.setOverrides(result);
}
 
Example 9
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setProviderOverrides(Provider provider, List<Override> overrides) {
	if (provider == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(provider)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(provider)) {
   			provider.setOverride(override);
   		}
   	}
	provider.setOverrides(overrides);
}
 
Example 10
Source File: OverrideUtils.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public static void setConsumerOverrides(Consumer consumer, List<Override> overrides) {
	if (consumer == null || overrides == null) {
		return;
	}
	List<Override> result = new ArrayList<Override>(overrides.size());
	for(Override override : overrides){
   		if (! override.isEnabled()) {
			continue;
		}
   		if (override.isMatch(consumer)) {
   			result.add(override);
   		}
   		if (override.isUniqueMatch(consumer)) {
   			consumer.setOverride(override);
   		}
   	}
	Collections.sort(result, OverrideUtils.OVERRIDE_COMPARATOR);
	consumer.setOverrides(result);
}
 
Example 11
Source File: Tool.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public static boolean isProviderEnabled(Provider provider, List<Override> oList){
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String disbaled = params.get(Constants.DISABLED_KEY);
     	if(disbaled != null && disbaled.length() > 0){
     		return ! "true".equals(disbaled);
     	}
		}
	}
	return provider.isEnabled();
}
 
Example 12
Source File: Tool.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
public static int getProviderWeight(Provider provider, List<Override> oList) {
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String weight = params.get(Constants.WEIGHT_KEY);
     	if(weight != null && weight.length() > 0){
     		return Integer.parseInt(weight);
     	}
		}
	}
	return provider.getWeight();
}
 
Example 13
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static boolean isProviderEnabled(Provider provider, List<Override> oList){
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String disbaled = params.get(Constants.DISABLED_KEY);
     	if(disbaled != null && disbaled.length() > 0){
     		return ! "true".equals(disbaled);
     	}
		}
	}
	return provider.isEnabled();
}
 
Example 14
Source File: Tool.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public static int getProviderWeight(Provider provider, List<Override> oList) {
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String weight = params.get(Constants.WEIGHT_KEY);
     	if(weight != null && weight.length() > 0){
     		return Integer.parseInt(weight);
     	}
		}
	}
	return provider.getWeight();
}
 
Example 15
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static boolean isProviderEnabled(Provider provider, List<Override> oList){
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String disbaled = params.get(Constants.DISABLED_KEY);
     	if(disbaled != null && disbaled.length() > 0){
     		return ! "true".equals(disbaled);
     	}
		}
	}
	return provider.isEnabled();
}
 
Example 16
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static int getProviderWeight(Provider provider, List<Override> oList) {
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String weight = params.get(Constants.WEIGHT_KEY);
     	if(weight != null && weight.length() > 0){
     		return Integer.parseInt(weight);
     	}
		}
	}
	return provider.getWeight();
}
 
Example 17
Source File: Tool.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
public static boolean isProviderEnabled(Provider provider, List<Override> oList){
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String disbaled = params.get(Constants.DISABLED_KEY);
     	if(disbaled != null && disbaled.length() > 0){
     		return ! "true".equals(disbaled);
     	}
		}
	}
	return provider.isEnabled();
}
 
Example 18
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static boolean isProviderEnabled(Provider provider, List<Override> oList){
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String disbaled = params.get(Constants.DISABLED_KEY);
     	if(disbaled != null && disbaled.length() > 0){
     		return ! "true".equals(disbaled);
     	}
		}
	}
	return provider.isEnabled();
}
 
Example 19
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static int getProviderWeight(Provider provider, List<Override> oList) {
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String weight = params.get(Constants.WEIGHT_KEY);
     	if(weight != null && weight.length() > 0){
     		return Integer.parseInt(weight);
     	}
		}
	}
	return provider.getWeight();
}
 
Example 20
Source File: Tool.java    From dubbox with Apache License 2.0 5 votes vote down vote up
public static int getProviderWeight(Provider provider, List<Override> oList) {
	for(Override o : oList){
		if (o.isMatch(provider)) {
 		Map<String, String> params = StringUtils.parseQueryString(o.getParams());
 		String weight = params.get(Constants.WEIGHT_KEY);
     	if(weight != null && weight.length() > 0){
     		return Integer.parseInt(weight);
     	}
		}
	}
	return provider.getWeight();
}