Search in sources :

Example 1 with BasicHadoopFileSystemFactory

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();
}
Also used : Path(org.apache.hadoop.fs.Path) LifecycleAware(org.apache.ignite.lifecycle.LifecycleAware) IgniteException(org.apache.ignite.IgniteException) BasicHadoopFileSystemFactory(org.apache.ignite.hadoop.fs.BasicHadoopFileSystemFactory) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) URL(java.net.URL)

Aggregations

URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 Path (org.apache.hadoop.fs.Path)1 IgniteException (org.apache.ignite.IgniteException)1 BasicHadoopFileSystemFactory (org.apache.ignite.hadoop.fs.BasicHadoopFileSystemFactory)1 LifecycleAware (org.apache.ignite.lifecycle.LifecycleAware)1