use of org.apache.ignite.hadoop.fs.BasicHadoopFileSystemFactory in project ignite by apache.
the class HadoopBasicFileSystemFactoryDelegate method start.
/** {@inheritDoc} */
@Override
public void start() throws IgniteException {
BasicHadoopFileSystemFactory proxy0 = (BasicHadoopFileSystemFactory) proxy;
cfg = HadoopUtils.safeCreateConfiguration();
if (proxy0.getConfigPaths() != null) {
for (String cfgPath : proxy0.getConfigPaths()) {
if (cfgPath == null)
throw new NullPointerException("Configuration path cannot be null: " + Arrays.toString(proxy0.getConfigPaths()));
else {
URL url = U.resolveIgniteUrl(cfgPath);
if (url == null) {
// If secConfPath is given, it should be resolvable:
throw new IgniteException("Failed to resolve secondary file system configuration path " + "(ensure that it exists locally and you have read access to it): " + cfgPath);
}
cfg.addResource(url);
}
}
}
// If secondary fs URI is not given explicitly, try to get it from the configuration:
if (proxy0.getUri() == null)
fullUri = FileSystem.getDefaultUri(cfg);
else {
try {
fullUri = new URI(proxy0.getUri());
} catch (URISyntaxException ignored) {
throw new IgniteException("Failed to resolve secondary file system URI: " + proxy0.getUri());
}
}
String strWorkDir = fullUri.getPath();
if (!"/".equals(strWorkDir))
workDir = new Path(strWorkDir);
usrNameMapper = proxy0.getUserNameMapper();
if (usrNameMapper != null && usrNameMapper instanceof LifecycleAware)
((LifecycleAware) usrNameMapper).start();
}
Aggregations