in modules/mesos-ext/src/main/java/org/apache/ignite/mesos/resource/ResourceProvider.java [61:135]
public void init(ClusterProperties props, IgniteProvider provider, String baseUrl) throws IOException {
if (props.ignitePackageUrl() == null && props.ignitePackagePath() == null) {
// Downloading ignite.
try {
igniteUrl = baseUrl + IGNITE_PREFIX + provider.getIgnite(props.igniteVer());
}
catch (Exception e) {
log.log(Level.SEVERE, "Failed to download Ignite [err={0}, ver={1}].\n" +
"If application working behind NAT or Intranet and does not have access to external resources " +
"then you can use IGNITE_PACKAGE_URL or IGNITE_PACKAGE_PATH property that allow to use local " +
"resources.",
new Object[]{e, props.igniteVer()});
}
}
if (props.ignitePackagePath() != null) {
Path ignitePackPath = Paths.get(props.ignitePackagePath());
if (Files.exists(ignitePackPath) && !Files.isDirectory(ignitePackPath)) {
try {
String fileName = provider.copyToWorkDir(props.ignitePackagePath());
assert fileName != null;
igniteUrl = baseUrl + IGNITE_PREFIX + fileName;
}
catch (Exception e) {
log.log(Level.SEVERE, "Failed to copy Ignite to working directory [err={0}, path={1}].",
new Object[] {e, props.ignitePackagePath()});
throw e;
}
}
else
throw new IllegalArgumentException("Failed to find a ignite archive by path: "
+ props.ignitePackagePath());
}
// Find all jar files into user folder.
if (props.userLibs() != null && !props.userLibs().isEmpty()) {
File libsDir = new File(props.userLibs());
List<String> libs = new ArrayList<>();
if (libsDir.isDirectory()) {
File[] files = libsDir.listFiles();
if (files != null) {
for (File lib : files) {
if (lib.isFile() && lib.canRead() &&
(lib.getName().endsWith(".jar") || lib.getName().endsWith(".JAR")))
libs.add(baseUrl + LIBS_PREFIX + lib.getName());
}
}
}
libsUris = libs.isEmpty() ? null : libs;
}
// Set configuration url.
if (props.igniteCfg() != null) {
File cfg = new File(props.igniteCfg());
if (cfg.isFile() && cfg.canRead()) {
cfgUrl = baseUrl + CONFIG_PREFIX + cfg.getName();
cfgName = cfg.getName();
}
}
else {
cfgName = "ignite-default-config.xml";
cfgUrl = baseUrl + DEFAULT_CONFIG + cfgName;
}
}