Java Code Examples for com.alibaba.dubbo.common.Constants#ROUTERS_CATEGORY

The following examples show how to use com.alibaba.dubbo.common.Constants#ROUTERS_CATEGORY . 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: ZookeeperRegistry.java    From dubbo-2.6.5 with Apache License 2.0 6 votes vote down vote up
private String[] toCategoriesPath(URL url) {
        String[] categories;
        if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
            categories = new String[]{Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY,
                    Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
        } else {
//            默认监听category值providers
            categories = url.getParameter(Constants.CATEGORY_KEY, new String[]{Constants.DEFAULT_CATEGORY});
        }
        String[] paths = new String[categories.length];
        for (int i = 0; i < categories.length; i++) {
//            /接口名+providers
            paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categories[i];
        }
        return paths;
    }
 
Example 2
Source File: ConsulRegistryTest.java    From dubbox with Apache License 2.0 6 votes vote down vote up
@Test
public void toCategoriesPath() {
	URL url = consumerUrl;
	String[] categroies;
	if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
		categroies = new String[] { Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY,
				Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY };
	} else {
		categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] { Constants.DEFAULT_CATEGORY });
	}
	String[] paths = new String[categroies.length];
	for (int i = 0; i < categroies.length; i++) {
		paths[i] = "dubbo" + Constants.PATH_SEPARATOR + categroies[i];
	}

	for (String s : paths) {
		System.out.println(s);
	}
}
 
Example 3
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private String[] toCategoriesPath(URL url) {
    String[] categroies;
    if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
        categroies = new String[] {Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY, 
                Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
    } else {
        categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] {Constants.DEFAULT_CATEGORY});
    }
    String[] paths = new String[categroies.length];
    for (int i = 0; i < categroies.length; i ++) {
        paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
    }
    return paths;
}
 
Example 4
Source File: ZookeeperRegistry.java    From dubbox-hystrix with Apache License 2.0 5 votes vote down vote up
private String[] toCategoriesPath(URL url) {
    String[] categroies;
    if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
        categroies = new String[] {Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY, 
                Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
    } else {
        categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] {Constants.DEFAULT_CATEGORY});
    }
    String[] paths = new String[categroies.length];
    for (int i = 0; i < categroies.length; i ++) {
        paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
    }
    return paths;
}
 
Example 5
Source File: ZookeeperRegistry.java    From dubbo3 with Apache License 2.0 5 votes vote down vote up
private String[] toCategoriesPath(URL url) {
    String[] categroies;
    if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
        categroies = new String[]{Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY,
                Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
    } else {
        categroies = url.getParameter(Constants.CATEGORY_KEY, new String[]{Constants.DEFAULT_CATEGORY});
    }
    String[] paths = new String[categroies.length];
    for (int i = 0; i < categroies.length; i++) {
        paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
    }
    return paths;
}
 
Example 6
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private String[] toCategoriesPath(URL url) {
    String[] categroies;
    if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
        categroies = new String[] {Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY, 
                Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
    } else {
        categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] {Constants.DEFAULT_CATEGORY});
    }
    String[] paths = new String[categroies.length];
    for (int i = 0; i < categroies.length; i ++) {
        paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
    }
    return paths;
}
 
Example 7
Source File: ZookeeperRegistry.java    From dubbox with Apache License 2.0 5 votes vote down vote up
private String[] toCategoriesPath(URL url) {
    String[] categroies;
    if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
        categroies = new String[] {Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY, 
                Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
    } else {
        categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] {Constants.DEFAULT_CATEGORY});
    }
    String[] paths = new String[categroies.length];
    for (int i = 0; i < categroies.length; i ++) {
        paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
    }
    return paths;
}