Java Code Examples for com.alibaba.dubbo.registry.common.domain.Provider#getParameters()

The following examples show how to use com.alibaba.dubbo.registry.common.domain.Provider#getParameters() . 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: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
   * 装载新增服务页面,获取所有的服务名称
   * @param context
   */
  public void add(Long id, Map<String, Object> context) {
  	if (context.get("service") == null) {
  		List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
  		context.put("serviceList", serviceList);
  	}
if (id != null) {
	Provider p = providerService.findProvider(id);
       if (p != null) {
       	context.put("provider", p);
		String parameters = p.getParameters();
		if (parameters != null && parameters.length() > 0) {
			Map<String, String> map = StringUtils.parseQueryString(parameters);
			map.put("timestamp", String.valueOf(System.currentTimeMillis()));
			map.remove("pid");
			p.setParameters(StringUtils.toQueryString(map));
		}
	}
}
  }
 
Example 2
Source File: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean create(Provider provider, Map<String, Object> context) {
    String service = provider.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    if (provider.getParameters() == null) {
     String url = provider.getUrl();
     if (url != null) {
      int i = url.indexOf('?');
      if (i > 0) {
      	provider.setUrl(url.substring(0, i));
      	provider.setParameters(url.substring(i + 1));
      }
     }
    }
    provider.setDynamic(false); // 页面上添加的一定是静态的Provider
    providerService.create(provider);
    return true;
}
 
Example 3
Source File: Providers.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
/**
   * 装载新增服务页面,获取所有的服务名称
   * @param context
   */
  public void add(Long id, Map<String, Object> context) {
  	if (context.get("service") == null) {
  		List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
  		context.put("serviceList", serviceList);
  	}
if (id != null) {
	Provider p = providerService.findProvider(id);
       if (p != null) {
       	context.put("provider", p);
		String parameters = p.getParameters();
		if (parameters != null && parameters.length() > 0) {
			Map<String, String> map = StringUtils.parseQueryString(parameters);
			map.put("timestamp", String.valueOf(System.currentTimeMillis()));
			map.remove("pid");
			p.setParameters(StringUtils.toQueryString(map));
		}
	}
}
  }
 
Example 4
Source File: Providers.java    From dubbox-hystrix with Apache License 2.0 6 votes vote down vote up
public boolean create(Provider provider, Map<String, Object> context) {
    String service = provider.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    if (provider.getParameters() == null) {
     String url = provider.getUrl();
     if (url != null) {
      int i = url.indexOf('?');
      if (i > 0) {
      	provider.setUrl(url.substring(0, i));
      	provider.setParameters(url.substring(i + 1));
      }
     }
    }
    provider.setDynamic(false); // 页面上添加的一定是静态的Provider
    providerService.create(provider);
    return true;
}
 
Example 5
Source File: Providers.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
/**
   * 装载新增服务页面,获取所有的服务名称
   * @param context
   */
  public void add(Long id, Map<String, Object> context) {
  	if (context.get("service") == null) {
  		List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
  		context.put("serviceList", serviceList);
  	}
if (id != null) {
	Provider p = providerService.findProvider(id);
       if (p != null) {
       	context.put("provider", p);
		String parameters = p.getParameters();
		if (parameters != null && parameters.length() > 0) {
			Map<String, String> map = StringUtils.parseQueryString(parameters);
			map.put("timestamp", String.valueOf(System.currentTimeMillis()));
			map.remove("pid");
			p.setParameters(StringUtils.toQueryString(map));
		}
	}
}
  }
 
Example 6
Source File: Providers.java    From dubbo3 with Apache License 2.0 6 votes vote down vote up
public boolean create(Provider provider, Map<String, Object> context) {
    String service = provider.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    if (provider.getParameters() == null) {
     String url = provider.getUrl();
     if (url != null) {
      int i = url.indexOf('?');
      if (i > 0) {
      	provider.setUrl(url.substring(0, i));
      	provider.setParameters(url.substring(i + 1));
      }
     }
    }
    provider.setDynamic(false); // 页面上添加的一定是静态的Provider
    providerService.create(provider);
    return true;
}
 
Example 7
Source File: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
   * 装载新增服务页面,获取所有的服务名称
   * @param context
   */
  public void add(Long id, Map<String, Object> context) {
  	if (context.get("service") == null) {
  		List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
  		context.put("serviceList", serviceList);
  	}
if (id != null) {
	Provider p = providerService.findProvider(id);
       if (p != null) {
       	context.put("provider", p);
		String parameters = p.getParameters();
		if (parameters != null && parameters.length() > 0) {
			Map<String, String> map = StringUtils.parseQueryString(parameters);
			map.put("timestamp", String.valueOf(System.currentTimeMillis()));
			map.remove("pid");
			p.setParameters(StringUtils.toQueryString(map));
		}
	}
}
  }
 
Example 8
Source File: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean create(Provider provider, Map<String, Object> context) {
    String service = provider.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    if (provider.getParameters() == null) {
     String url = provider.getUrl();
     if (url != null) {
      int i = url.indexOf('?');
      if (i > 0) {
      	provider.setUrl(url.substring(0, i));
      	provider.setParameters(url.substring(i + 1));
      }
     }
    }
    provider.setDynamic(false); // 页面上添加的一定是静态的Provider
    providerService.create(provider);
    return true;
}
 
Example 9
Source File: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
/**
   * 装载新增服务页面,获取所有的服务名称
   * @param context
   */
  public void add(Long id, Map<String, Object> context) {
  	if (context.get("service") == null) {
  		List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
  		context.put("serviceList", serviceList);
  	}
if (id != null) {
	Provider p = providerService.findProvider(id);
       if (p != null) {
       	context.put("provider", p);
		String parameters = p.getParameters();
		if (parameters != null && parameters.length() > 0) {
			Map<String, String> map = StringUtils.parseQueryString(parameters);
			map.put("timestamp", String.valueOf(System.currentTimeMillis()));
			map.remove("pid");
			p.setParameters(StringUtils.toQueryString(map));
		}
	}
}
  }
 
Example 10
Source File: Providers.java    From dubbox with Apache License 2.0 6 votes vote down vote up
public boolean create(Provider provider, Map<String, Object> context) {
    String service = provider.getService();
    if (!super.currentUser.hasServicePrivilege(service)) {
        context.put("message", getMessage("HaveNoServicePrivilege", service));
        return false;
    }
    if (provider.getParameters() == null) {
     String url = provider.getUrl();
     if (url != null) {
      int i = url.indexOf('?');
      if (i > 0) {
      	provider.setUrl(url.substring(0, i));
      	provider.setParameters(url.substring(i + 1));
      }
     }
    }
    provider.setDynamic(false); // 页面上添加的一定是静态的Provider
    providerService.create(provider);
    return true;
}