本文整理了Java中gov.nist.toolkit.installation.server.Installation.environmentFile()
方法的一些代码示例,展示了Installation.environmentFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Installation.environmentFile()
方法的具体详情如下:
包路径:gov.nist.toolkit.installation.server.Installation
类名称:Installation
方法名:environmentFile
暂无
代码示例来源:origin: usnistgov/iheos-toolkit2
public File getKeystoreDir(String environmentName) {
return new File(environmentFile(environmentName), "keystore");
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public List<String> getEnvironmentNames() {
List<String> names = new ArrayList<>();
File envsFile = environmentFile();
for (File envFile : envsFile.listFiles()) {
if (envFile.isDirectory())
names.add(envFile.getName());
}
return names;
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public File getDefaultCodesFile() {
return new File(environmentFile(defaultEnvironmentName()), "codes.xml");
}
代码示例来源:origin: usnistgov/iheos-toolkit2
static public File getRoot(String environmentName, TestSession testSession) {
String sep = File.separator;
StringBuilder buf = new StringBuilder();
buf.append(Installation.instance().environmentFile().toString());
buf.append(sep).append(environmentName);
buf.append(sep).append("testkits");
buf.append(sep).append(testSession.getValue());
return new File(buf.toString());
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public static String validate() {
File location = Installation.instance().externalCache();
if (!location.exists()) return String.format("External Cache location %s does not exist. " + HOW_TO_FIX, location);
if (!location.isDirectory()) return String.format("External Cache location %s is not a directory. " + HOW_TO_FIX, location);
if (!location.canWrite()) return String.format("External Cache location %s cannot be written. " + HOW_TO_FIX, location);
File defEnv = Installation.instance().environmentFile("default");
if (!defEnv.exists()) return String.format("Default Environment (default) not found in External Cache (%s). " +
HOW_TO_FIX,
location);
return null;
}
代码示例来源:origin: usnistgov/iheos-toolkit2
/**
* This method returns all the existing testkits.
* @return list of all existing testkits.
*/
public List<File> getAllTestkits(){
List<File> testkits=new ArrayList<File>();
File environmentsRootFile=environmentFile();
File[] envList=environmentsRootFile.listFiles();
if (envList!=null) {
for (File environment : envList) {
File testkitsContainer = new File(environment, "testkits");
if (testkitsContainer.exists()) {
testkits.addAll(Arrays.asList(testkitsContainer.listFiles()));
}
}
}
testkits.add(internalTestkitFile());
return testkits;
}
代码示例来源:origin: usnistgov/iheos-toolkit2
private File getEnvironmentDir() throws EnvironmentNotSelectedException {
File env = Installation.instance().environmentFile(environmentName);
if (!env.exists() || !env.isDirectory())
throw new EnvironmentNotSelectedException("Environment " + environmentName + " does not exist");
return env;
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public EnvSetting(String envName) {
this.envName = envName;
this.envDir = Installation.instance().environmentFile(envName);
validateEnvironment();
}
代码示例来源:origin: usnistgov/iheos-toolkit2
private void handleCodesDownload(HttpServletResponse response, String[] parts) {
String envName;
try {
envName = parts[0];
} catch (Exception e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
logger.debug("codes download of " + envName);
if (envName == null || envName.trim().equals("")) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
try {
File codesFile = new File(Installation.instance().environmentFile(envName), "codes.xml");
if (!codesFile.exists()) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
String codesContent = Io.stringFromFile(codesFile);
response.setContentType("text/xml");
response.getOutputStream().print(codesContent);
response.getOutputStream().close();
response.addHeader("Content-Disposition", "attachment; filename=" + "codes.xml");
} catch (Exception e) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return;
}
response.setStatus(HttpServletResponse.SC_OK);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public static void installDefaultEnvironment() {
File envFile = Installation.instance()./*internal*/environmentFile(DEFAULTENVIRONMENTNAME);
if (envFile == null || !envFile.exists()) throw new EnvironmentNotSelectedException("Default Environment not configured - file " + envFile + " not found.");
new EnvSetting(DEFAULTSESSIONID, DEFAULTENVIRONMENTNAME, envFile);
// new EnvSetting(Installation.defaultSessionName(), DEFAULTENVIRONMENTNAME, envFile);
// new EnvSetting(Installation.defaultServiceSessionName(), DEFAULTENVIRONMENTNAME, envFile);
}
代码示例来源:origin: usnistgov/iheos-toolkit2
private static void initializeExternalCacheWithInternalData(File externalCache) throws XdsException {
logger.info("Initialize external cache check");
if (!Installation.instance().environmentFile().exists() || !Installation.instance().environmentFile(Installation.DEFAULT_ENVIRONMENT_NAME).exists()) {
logger.info("Initializing environments in " + externalCache);
try {
FileUtils.copyDirectory(Installation.instance().internalEnvironmentsFile(), new File(externalCache, "environment"));
} catch (IOException e) {
throw new XdsException("Cannot initialize environments area of External Cache at " + externalCache, "", e);
}
} else {
logger.info("Environments exist - not updating.");
}
logger.info("Initializing datasets in " + externalCache);
try {
FileUtils.copyDirectory(Installation.instance().internalDatasetsFile(), new File(externalCache, "datasets"));
} catch (IOException e) {
String msg = "Cannot initialize datasets area of External Cache at " + externalCache + " - " + e.getMessage();
logger.error(msg);
}
logger.info("Initializing resource cache in " + externalCache);
try {
FileUtils.copyDirectory(Installation.instance().internalResourceCacheFile(), new File(externalCache, "resourceCache"));
} catch (IOException e) {
String msg = "Cannot initialize resourceCache area of External Cache at " + externalCache + " - " + e.getMessage();
logger.error(msg);
}
}
代码示例来源:origin: usnistgov/iheos-toolkit2
public EnvSetting(String sessionId, String name) {
File dir = Installation.instance().environmentFile(name);
// logger.info("Session " + sessionId + " environment " + name + " ==> " + dir);
addSetting(sessionId, new EnvSetting(name, dir));
}
代码示例来源:origin: usnistgov/iheos-toolkit2
File environmentTestkitsFile = new File(environmentFile(environmentName), "testkits");
File usrTestkit=null;
if (testSession!=null) {
代码示例来源:origin: usnistgov/iheos-toolkit2
synchronized public static void reinitialize(File location) throws XdsException {
logger.info("Reinitialize External Cache to " + location);
Installation.instance().externalCache(null); // so that it can be updated
String error = initialize(location);
if (error != null) throw new XdsException(error, "");
File environment = Installation.instance().environmentFile();
// initialize environment
initializeExternalCacheWithInternalData(location);
// initialize test log cache
Installation.instance().testLogCache(TestSession.DEFAULT_TEST_SESSION).mkdirs();
// initialize SimDb
Installation.instance().simDbFile(TestSession.DEFAULT_TEST_SESSION).mkdirs();
// initialize actors
Installation.instance().actorsDir(TestSession.DEFAULT_TEST_SESSION).mkdirs();
}
内容来源于网络,如有侵权,请联系作者删除!