package com.walker.infrastructure.arguments.support;
import java.io.File;
import java.io.InputStream;
import java.util.List;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.Resource;
import com.walker.infrastructure.arguments.AbstractArgumentsManager;
import com.walker.infrastructure.arguments.ArgumentsException;
import com.walker.infrastructure.arguments.Group;
import com.walker.infrastructure.utils.StringUtils;
/**
* 基于文件存储的配置参数管理器默认实现
* @author shikeying
*
*/
public abstract class FileArgumentsManager extends AbstractArgumentsManager {
private String classPathFileName;
/* 文件的绝对路径 */
private String filePath;
/**
* 返回文件的绝对路径
* @return
*/
public String getFilePath() {
return filePath;
}
/**
* 设置文件名称,使用classpath
下的文件名,即:文件必须维护类路径中。
* myfile.xml * conf/myfile.xml ** @param fileName */ public void setClasspathFileName(String fileName){ assert (StringUtils.isNotEmpty(fileName)); // if(fileName.startsWith(AttributeUtils.CLASSPATH_PREFIX)){ // this.classPathFileName = fileName; // } else // throw new IllegalArgumentException("fileName must start with 'classpath:'."); this.classPathFileName = fileName; } /** * 设置可变参数文件的绝对文件名,如:d:/files/config.xml * @param absoluteFilename */ public void setFileSystemFileName(String absoluteFilename){ assert (StringUtils.isNotEmpty(absoluteFilename)); this.filePath = absoluteFilename; } @Override protected List