private void addAsLocalResource(Map<File, String> resources, ContainerId containerId,
ContainerLaunchContext containerLaunchContext)
throws IOException {
for (Map.Entry<File, String> resource : resources.entrySet()) {
File localFile = resource.getKey();
if (!localFile.exists() || !localFile.canRead()) {
throw new IOException("Crypto material file " + localFile.getAbsolutePath() + " for container " +
containerId.toString() + " does not exist or cannot be read");
}
URL fileURL = URL.newInstance("file", null, -1, localFile.getAbsolutePath());
LocalResource localResource = LocalResource.newInstance(fileURL,
LocalResourceType.FILE, LocalResourceVisibility.PRIVATE,
localFile.length(), localFile.lastModified());
containerLaunchContext.getLocalResources().put(resource.getValue(), localResource);
}
}