Java Code Examples for org.apache.commons.lang.StringUtils.endsWithIgnoreCase()

The following are Jave code examples for showing how to use endsWithIgnoreCase() of the org.apache.commons.lang.StringUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Hydrograph   File: JobCreationPage.java   Source Code and License Vote up 6 votes
protected boolean validatePage() {
	boolean returnCode=  super.validatePage() && validateFilename();
	if(returnCode){
		IPath iPath=new Path(getContainerFullPath()+JOBS_FOLDER_NAME);
		IFolder folder=ResourcesPlugin.getWorkspace().getRoot().getFolder(iPath);
		if(!StringUtils.endsWithIgnoreCase(getFileName(), Constants.JOB_EXTENSION)){
			IFile newFile= folder.getFile(getFileName()+Constants.JOB_EXTENSION);
			if(newFile.exists()){
				setErrorMessage("'"+newFile.getName()+"'"+Constants.ALREADY_EXISTS);
				return false;
			}
		}
	}
	return returnCode;
	
}
 
Example 2
Project: atlas   File: NativeSoFilter.java   Source Code and License Vote up 5 votes
@Override
public boolean accept(File file) {

    if (file.isDirectory()) {
        return true;
    } else {
        String fileName = file.getName();
        if(null != removeSoFiles  && removeSoFiles.size() > 0){
            if(removeSoFiles.contains(fileName)){
                return false;
            }
        }

        String path = file.getAbsolutePath();
        boolean isSupportAbi = false;
        if(null != supportAbis && supportAbis.size() > 0) {
            for (String supportAbi : supportAbis) {
                String abi = File.separator + supportAbi + File.separator + fileName;
                if (path.indexOf(abi) > 0) {
                    isSupportAbi = true;
                    break;
                }
            }
        }else{
            isSupportAbi=true;
        }
        if (isSupportAbi
            && (StringUtils.endsWithIgnoreCase(fileName, ".so") || "gdbserver".equalsIgnoreCase(fileName))) {
            return true;
        }
    }
    return false;
}
 
Example 3
Project: atlas   File: ApkFileListUtils.java   Source Code and License Vote up 5 votes
private static boolean isImageFile(String name) {
    for (String imgExt : IMG_EXTENSIONS) {
        if (StringUtils.endsWithIgnoreCase(name, imgExt)) {
            return true;
        }
    }
    return false;
}
 
Example 4
Project: atlas   File: CodeInjectByJavassist.java   Source Code and License Vote up 5 votes
/**
 * The injection of code for the specified jar package
 *
 * @param inJar
 * @param outJar
 * @throws IOException
 * @throws NotFoundException
 * @throws CannotCompileException
 */
public static List<String> inject(ClassPool pool,
                                  File inJar,
                                  File outJar,
                                  InjectParam injectParam) throws Exception {
    List<String> errorFiles = new ArrayList<String>();
    JarFile jarFile = newJarFile(inJar);

    outJar.getParentFile().mkdirs();
    FileOutputStream fileOutputStream = new FileOutputStream(outJar);
    JarOutputStream jos = new JarOutputStream(new BufferedOutputStream(fileOutputStream));
    Enumeration<JarEntry> jarFileEntries = jarFile.entries();
    JarEntry jarEntry = null;
    while (jarFileEntries.hasMoreElements()) {
        jarEntry = jarFileEntries.nextElement();
        String name = jarEntry.getName();
        String className = StringUtils.replace(name, File.separator, "/");
        className = StringUtils.replace(className, "/", ".");
        className = StringUtils.substring(className, 0, className.length() - 6);
        if (!StringUtils.endsWithIgnoreCase(name, ".class")) {
            InputStream inputStream = jarFile.getInputStream(jarEntry);
            copyStreamToJar(inputStream, jos, name, jarEntry.getTime(), jarEntry);
            IOUtils.closeQuietly(inputStream);
        } else {
            byte[] codes;

            codes = inject(pool, className, injectParam);
            InputStream classInstream = new ByteArrayInputStream(codes);
            copyStreamToJar(classInstream, jos, name, jarEntry.getTime(), jarEntry);

        }
    }
    jarFile.close();
    IOUtils.closeQuietly(jos);
    return errorFiles;
}
 
Example 5
Project: otter-G   File: NodeOp.java   Source Code and License Vote up 5 votes
public void execute(@Param("nid") Long nid, @Param("command") String command, @Param("value") String value) {
    try {
        if (StringUtils.equalsIgnoreCase(command, OFFLINE)) {
            List<Channel> channels = channelService.listByNodeId(nid, ChannelStatus.START);
            for (Channel channel : channels) {// 重启一下对应的channel
                boolean result = arbitrateManageService.channelEvent().restart(channel.getId());
                if (result) {
                    channelService.notifyChannel(channel.getId());// 推送一下配置
                }
            }
        } else if (StringUtils.equalsIgnoreCase(command, ONLINE)) {
            // doNothing,自动会加入服务列表
        } else if (StringUtils.endsWithIgnoreCase(command, THREAD)) {
            nodeRemoteService.setThreadPoolSize(nid, Integer.valueOf(value));
        } else if (StringUtils.endsWithIgnoreCase(command, PROFILE)) {
            nodeRemoteService.setProfile(nid, BooleanUtils.toBoolean(value));
        } else {
            returnError("please add specfy the 'command' param.");
            return;
        }

        returnSuccess();
    } catch (Exception e) {
        String errorMsg = String.format("error happens while [%s] with node id [%d]", command, nid);
        log.error(errorMsg, e);
        returnError(errorMsg);
    }
}
 
Example 6
Project: Hydrograph   File: MultiParameterFileDialog.java   Source Code and License Vote up 5 votes
private boolean importParamterFileToProject(String[] listOfFilesToBeImported, String source,String destination, ParamterFileTypes paramterFileTypes) {

		for (String fileName : listOfFilesToBeImported) {
			String absoluteFileName = source + fileName;
			IPath destinationIPath=new Path(destination);
			destinationIPath=destinationIPath.append(fileName);
			File destinationFile=destinationIPath.toFile();
			try {
				if (!ifDuplicate(listOfFilesToBeImported, paramterFileTypes)) {
					if (StringUtils.equalsIgnoreCase(absoluteFileName, destinationFile.toString())) {
						return true;
					} else if (destinationFile.exists()) {
						int returnCode = doUserConfirmsToOverRide();
						if (returnCode == SWT.YES) {
							FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
						} else if (returnCode == SWT.NO) {
							return true;
						} else {
							return false;
						}
					} else {
						FileUtils.copyFileToDirectory(new File(absoluteFileName), new File(destination));
					}
				}
			} catch (IOException e1) {
				if(StringUtils.endsWithIgnoreCase(e1.getMessage(), ErrorMessages.IO_EXCEPTION_MESSAGE_FOR_SAME_FILE)){
					return true;
				}
				MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_ERROR | SWT.OK);
				messageBox.setText(MessageType.ERROR.messageType());
				messageBox.setMessage(ErrorMessages.UNABLE_TO_POPULATE_PARAM_FILE + " " + e1.getMessage());
				messageBox.open();				
				logger.error("Unable to copy prameter file in current project work space");
				return false;
			}
		}
		return true;
	}
 
Example 7
Project: Hydrograph   File: ELTSchemaGridWidget.java   Source Code and License Vote up 5 votes
private static boolean checkEndsWith(String finalParamPath, String[] fileExtensions) {
	for(String extension:fileExtensions){
		if(StringUtils.endsWithIgnoreCase(finalParamPath, extension)){
			return true;
		}
	}
	return false;
}
 
Example 8
Project: Hydrograph   File: PathUtility.java   Source Code and License Vote up 5 votes
private static boolean checkEndsWith(String finalParamPath, String[] fileExtensions) {
	for(String extension:fileExtensions){
		if(StringUtils.endsWithIgnoreCase(finalParamPath, extension)){
			return true;
		}
	}
	return false;
}
 
Example 9
Project: Hydrograph   File: JdkPathDialog.java   Source Code and License Vote up 5 votes
private String getTextBoxValue() {
	String textValue = text.getText();
	if (!StringUtils.endsWithIgnoreCase(textValue, File.separator+"bin")) {
		textValue = textValue + File.separator+"bin";
	}
	return textValue;
}
 
Example 10
Project: otter-G   File: MessageParser.java   Source Code and License Vote up 4 votes
/**
 * <pre>
 * the table def: 
 *              channel_info varchar
 *              channel_id varchar
 * 每次解析时,每个事务首先获取 retl_mark 下的 channel_info 或 channel_id 字段变更。
 *  a. 如果存在 channel_info 以 '_SYNC'结尾的字符串 ,则忽略本次事务的数据变更;
 *  b. 如果不等于,则执行下面的判断。
 *      i. 如果存在channel_id = "xx",则检查对应的channel_id是否为当前同步的channelId,如果是则忽略。
 *      ii. 不存在则不处理
 * </pre>
 */
private int checkLoopback(Pipeline pipeline, RowData rowData) {
    // 检查channel_info字段
    // 首先检查下after记录,从无变有的过程,一般出现在事务头
    Column infokColumn = getColumnIgnoreCase(rowData.getAfterColumnsList(), pipeline.getParameters()
        .getSystemMarkTableInfo());

    // 匹配对应的channelInfo,如果以_SYNC结尾,则认为需要忽略
    if (infokColumn != null && StringUtils.endsWithIgnoreCase(infokColumn.getValue(), RETL_CLIENT_FLAG)) {
        return 1;
    }

    // 匹配对应的channelInfo,如果相同,则认为需要忽略,并返回2,代表需要进行回环补救check机制,因为这个变更也是otter系统产生的
    if (infokColumn != null
        && StringUtils.equalsIgnoreCase(infokColumn.getValue(), pipeline.getParameters().getChannelInfo())) {
        return 2;
    }

    infokColumn = getColumnIgnoreCase(rowData.getBeforeColumnsList(), pipeline.getParameters()
        .getSystemMarkTableInfo());
    // 匹配对应的channelInfo,如果以_SYNC结尾,则认为需要忽略
    if (infokColumn != null && StringUtils.endsWithIgnoreCase(infokColumn.getValue(), RETL_CLIENT_FLAG)) {
        return 1;
    }

    // 匹配对应的channelInfo,如果相同,则认为需要忽略,并返回2,代表需要进行回环补救check机制,因为这个变更也是otter系统产生的
    if (infokColumn != null
        && StringUtils.equalsIgnoreCase(infokColumn.getValue(), pipeline.getParameters().getChannelInfo())) {
        return 2;
    }

    // 检查channel_id字段
    Column markColumn = getColumnIgnoreCase(rowData.getAfterColumnsList(), pipeline.getParameters()
        .getSystemMarkTableColumn());
    // 匹配对应的channel id
    if (markColumn != null && pipeline.getChannelId().equals(Long.parseLong(markColumn.getValue()))) {
        return 2;
    }

    markColumn = getColumnIgnoreCase(rowData.getBeforeColumnsList(), pipeline.getParameters()
        .getSystemMarkTableColumn());
    if (markColumn != null && pipeline.getChannelId().equals(Long.parseLong(markColumn.getValue()))) {
        return 2;
    }

    return 0;
}
 
Example 11
Project: Hydrograph   File: PreStartActivity.java   Source Code and License Vote up 4 votes
private String getSystemJavaHomeValue() {
	String javaHome =System.getenv(JAVA_HOME);
	if (!StringUtils.endsWithIgnoreCase(javaHome, SLASH_BIN))
		javaHome = javaHome + SLASH_BIN;
	return javaHome;
}