Java Code Examples for com.jeesuite.common.util.ResourceUtils#containsProperty()

The following examples show how to use com.jeesuite.common.util.ResourceUtils#containsProperty() . 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: ServerEnvUtils.java    From jeesuite-config with Apache License 2.0 6 votes vote down vote up
public static String getServerIpAddr()  {  
	if(ResourceUtils.containsProperty("spring.cloud.client.ipAddress")){
		return ResourceUtils.getProperty("spring.cloud.client.ipAddress");
	}
	if(serverIpAddr != null)return serverIpAddr;
	try {
		Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();  
		outter:while (en.hasMoreElements()) {  
			NetworkInterface i = en.nextElement();  
			for (Enumeration<InetAddress> en2 = i.getInetAddresses(); en2.hasMoreElements();) {  
				InetAddress addr = en2.nextElement();  
				if (!addr.isLoopbackAddress()) {  
					if (addr instanceof Inet4Address) {    
						serverIpAddr = addr.getHostAddress();  
						break outter;
					}  
				}  
			}  
		}  
	} catch (Exception e) {
		serverIpAddr = UNKNOW;
	}
    return serverIpAddr;  
}
 
Example 2
Source File: MutiRouteDataSource.java    From jeesuite-libs with Apache License 2.0 6 votes vote down vote up
/** 
   * 功能说明:解析配置,得到数据源Map 
   * @return 
   * @throws IOException 
   */  
  private Map<String, Properties> parseDataSourceConfig(){  
      // 属性文件  
      Map<String, Properties> mapDataSource = new HashMap<String,Properties>(); 
      
String datasourceKey = MASTER_KEY;
Properties nodeProperties = parseNodeConfig(datasourceKey); 
mapDataSource.put(datasourceKey, nodeProperties);

//解析同组下面的slave
int index = 1;
while(true){
	datasourceKey = "slave" + index;
	if(!ResourceUtils.containsProperty(datasourceKey + ".db.url") && !ResourceUtils.containsProperty(datasourceKey + ".db.jdbcUrl"))break;
	nodeProperties = parseNodeConfig(datasourceKey); 
	mapDataSource.put(datasourceKey, nodeProperties);
	index++;
}

      return mapDataSource;  
  }
 
Example 3
Source File: MybatisConfigs.java    From jeesuite-libs with Apache License 2.0 6 votes vote down vote up
public static String[] getHanlderNames(String group){
       List<String> hanlders = new ArrayList<>();
	if(ResourceUtils.containsProperty(INTERCEPTOR_HANDLERCLASS)){
		String[] customHanlderClass = StringUtils.tokenizeToStringArray(ResourceUtils.getProperty(INTERCEPTOR_HANDLERCLASS), ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);
		hanlders.addAll(Arrays.asList(customHanlderClass));
	}
	
	if (isCacheEnabled(group)) {
		hanlders.add(CacheHandler.NAME);
	}

	if (isRwRouteEnabled(group)) {
		hanlders.add(RwRouteHandler.NAME);
	}
	
	if (isPaginationEnabled(group)) {
		hanlders.add(PaginationHandler.NAME);
	}
	
	return hanlders.toArray(new String[0]);
}
 
Example 4
Source File: ScheduleAdminController.java    From oneplatform with Apache License 2.0 5 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	if("zookeeper".equals(ResourceUtils.getProperty("jeesuite.task.registryType")) && 
			ResourceUtils.containsProperty("jeesuite.task.registryServers")){
		monitor = new SchedulerMonitor("zookeeper", ResourceUtils.getProperty("jeesuite.task.registryServers"));
	}else{
		monitor = new SchedulerMonitor(null, null);
	}
}
 
Example 5
Source File: KafkaAdminController.java    From oneplatform with Apache License 2.0 4 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	if(ResourceUtils.containsProperty("zookeeper.servers") && ResourceUtils.containsProperty("kafka.bootstrap.servers")){
		 monitor = new KafkaMonitor(ResourceUtils.getProperty("zookeeper.servers"), ResourceUtils.getProperty("kafka.bootstrap.servers"), 1000);
	}
}