[IGNITE-349]: Some more corrections.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/be4cd29a Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/be4cd29a Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/be4cd29a Branch: refs/heads/ignite-349 Commit: be4cd29a4f504d6cf90e2ef345d8a4c2fe5499ef Parents: bbaf2a7 Author: iveselovskiy <iveselovs...@gridgain.com> Authored: Tue Mar 3 16:54:17 2015 +0300 Committer: iveselovskiy <iveselovs...@gridgain.com> Committed: Tue Mar 3 16:54:17 2015 +0300 ---------------------------------------------------------------------- .../ignite/internal/processors/igfs/IgfsEx.java | 8 ++--- .../visor/node/VisorIgfsConfiguration.java | 7 ++-- .../hadoop/IgfsHadoopFileSystemWrapper.java | 11 +++--- .../igfs/hadoop/v1/IgfsHadoopFileSystem.java | 11 +++--- .../igfs/hadoop/v2/IgfsHadoopFileSystem.java | 11 +++--- .../hadoop/SecondaryFileSystemProvider.java | 38 +++++++++----------- 6 files changed, 39 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java index f247fba..a380a6d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsEx.java @@ -29,14 +29,10 @@ import java.net.*; * Internal API extension for {@link org.apache.ignite.IgniteFs}. */ public interface IgfsEx extends IgniteFs { - /** - * Property name for path to Hadoop configuration. - */ + /** Property name for path to Hadoop configuration. */ String SECONDARY_FS_CONFIG_PATH = "SECONDARY_FS_CONFIG_PATH"; - /** - * Property name for URI of file system. - */ + /** Property name for URI of file system. */ String SECONDARY_FS_URI = "SECONDARY_FS_URI"; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java index b8fa57c..78943a2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorIgfsConfiguration.java @@ -19,9 +19,9 @@ package org.apache.ignite.internal.visor.node; import org.apache.ignite.configuration.*; import org.apache.ignite.igfs.*; -import org.apache.ignite.internal.processors.igfs.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; import java.io.*; import java.util.*; @@ -32,7 +32,6 @@ import static org.apache.ignite.internal.visor.util.VisorTaskUtils.*; * Data transfer object for IGFS configuration properties. */ public class VisorIgfsConfiguration implements Serializable { - /** */ private static final long serialVersionUID = 0L; @@ -138,8 +137,8 @@ public class VisorIgfsConfiguration implements Serializable { if (secFs != null) { Map<String, String> props = secFs.properties(); - cfg.secondaryHadoopFileSysUri = props.get(IgfsEx.SECONDARY_FS_URI); - cfg.secondaryHadoopFileSysCfgPath = props.get(IgfsEx.SECONDARY_FS_CONFIG_PATH); + cfg.secondaryHadoopFileSysUri = props.get(SECONDARY_FS_URI); + cfg.secondaryHadoopFileSysCfgPath = props.get(SECONDARY_FS_CONFIG_PATH); } cfg.dfltMode = igfs.getDefaultMode(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/IgfsHadoopFileSystemWrapper.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/IgfsHadoopFileSystemWrapper.java b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/IgfsHadoopFileSystemWrapper.java index 00aa372..6b3de5d 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/IgfsHadoopFileSystemWrapper.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/IgfsHadoopFileSystemWrapper.java @@ -28,6 +28,7 @@ import org.apache.ignite.internal.processors.hadoop.*; import org.apache.ignite.internal.processors.igfs.*; import org.apache.ignite.internal.util.typedef.*; import org.jetbrains.annotations.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; import java.io.*; import java.net.*; @@ -63,18 +64,18 @@ public class IgfsHadoopFileSystemWrapper implements Igfs, AutoCloseable { */ public IgfsHadoopFileSystemWrapper(@Nullable String uri, @Nullable String cfgPath) throws IgniteCheckedException { try { - SecondaryFileSystemProvider secondaryFileSystemProvider = + SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(uri, cfgPath); - fileSys = secondaryFileSystemProvider.createFileSystem(); + fileSys = secProvider.createFileSystem(); - uri = secondaryFileSystemProvider.secondaryFsUri().toString(); + uri = secProvider.uri().toString(); if (!uri.endsWith("/")) uri += "/"; - props.put(IgfsEx.SECONDARY_FS_CONFIG_PATH, cfgPath); - props.put(IgfsEx.SECONDARY_FS_URI, uri); + props.put(SECONDARY_FS_CONFIG_PATH, cfgPath); + props.put(SECONDARY_FS_URI, uri); } catch (IOException e) { throw new IgniteCheckedException(e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v1/IgfsHadoopFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v1/IgfsHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v1/IgfsHadoopFileSystem.java index 1f7b87e..6c032ff 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v1/IgfsHadoopFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v1/IgfsHadoopFileSystem.java @@ -44,6 +44,7 @@ import static org.apache.ignite.configuration.IgfsConfiguration.*; import static org.apache.ignite.igfs.IgfsMode.*; import static org.apache.ignite.igfs.hadoop.IgfsHadoopParameters.*; import static org.apache.ignite.internal.igfs.hadoop.IgfsHadoopUtils.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; /** * {@code IGFS} Hadoop 1.x file system driver over file system API. To use @@ -282,15 +283,15 @@ public class IgfsHadoopFileSystem extends FileSystem { if (initSecondary) { Map<String, String> props = paths.properties(); - String secUri = props.get(IgfsEx.SECONDARY_FS_URI); - String secConfPath = props.get(IgfsEx.SECONDARY_FS_CONFIG_PATH); + String secUri = props.get(SECONDARY_FS_URI); + String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH); try { - SecondaryFileSystemProvider secondaryFileSystemProvider = + SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath); - secondaryFs = secondaryFileSystemProvider.createFileSystem(); - secondaryUri = secondaryFileSystemProvider.secondaryFsUri(); + secondaryFs = secProvider.createFileSystem(); + secondaryUri = secProvider.uri(); } catch (IOException e) { if (!mgmt) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v2/IgfsHadoopFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v2/IgfsHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v2/IgfsHadoopFileSystem.java index 8398907..84accb1 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v2/IgfsHadoopFileSystem.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/igfs/hadoop/v2/IgfsHadoopFileSystem.java @@ -44,6 +44,7 @@ import static org.apache.ignite.configuration.IgfsConfiguration.*; import static org.apache.ignite.igfs.IgfsMode.*; import static org.apache.ignite.igfs.hadoop.IgfsHadoopParameters.*; import static org.apache.ignite.internal.igfs.hadoop.IgfsHadoopUtils.*; +import static org.apache.ignite.internal.processors.igfs.IgfsEx.*; /** * {@code IGFS} Hadoop 2.x file system driver over file system API. To use @@ -277,15 +278,15 @@ public class IgfsHadoopFileSystem extends AbstractFileSystem implements Closeabl if (initSecondary) { Map<String, String> props = paths.properties(); - String secUri = props.get(IgfsEx.SECONDARY_FS_URI); - String secConfPath = props.get(IgfsEx.SECONDARY_FS_CONFIG_PATH); + String secUri = props.get(SECONDARY_FS_URI); + String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH); try { - SecondaryFileSystemProvider secondaryFileSystemProvider = + SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath); - secondaryFs = secondaryFileSystemProvider.createAbstractFileSystem(); - secondaryUri = secondaryFileSystemProvider.secondaryFsUri(); + secondaryFs = secProvider.createAbstractFileSystem(); + secondaryUri = secProvider.uri(); } catch (IOException e) { throw new IOException("Failed to connect to the secondary file system: " + secUri, e); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/be4cd29a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java ---------------------------------------------------------------------- diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java index a63242c..722cc6c 100644 --- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java +++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/SecondaryFileSystemProvider.java @@ -29,15 +29,11 @@ import java.net.*; * Encapsulates logic of secondary filesystem creation. */ public class SecondaryFileSystemProvider { - /** - * Configuration of the secondary filesystem, never null. - */ + /** Configuration of the secondary filesystem, never null. */ private final Configuration cfg = new Configuration(); - /** - * The secondary filesystem URI, never null. - */ - private final URI secondaryFsUri; + /** The secondary filesystem URI, never null. */ + private final URI uri; /** * Creates new provider with given config parameters. The configuration URL is optional. The filesystem URI must be @@ -54,32 +50,30 @@ public class SecondaryFileSystemProvider { URL url = U.resolveIgniteUrl(secConfPath); if (url == null) { // If secConfPath is given, it should be resolvable: - throw new IllegalArgumentException("Failed to resolve secondary Fs " + - "configuration path [" + secConfPath + "]"); + throw new IllegalArgumentException("Failed to resolve secondary file system " + + "configuration path: " + secConfPath); } cfg.addResource(url); } // if secondary fs URI is not given explicitly, try to get it from the configuration: - if (secUri == null) { - secondaryFsUri = FileSystem.getDefaultUri(cfg); - } + if (secUri == null) + uri = FileSystem.getDefaultUri(cfg); else { try { - secondaryFsUri = new URI(secUri); + uri = new URI(secUri); } catch (URISyntaxException use) { throw new IOException("Failed to resolve secondary file system URI: " + secUri); } } - if (secondaryFsUri == null) { - throw new IllegalArgumentException("Failed to get secondary file system URI: it is neither given " + - "explicitly nor specified in the configuration: " + secConfPath); - } + if (uri == null) + throw new IllegalArgumentException("Failed to get secondary file system URI (it is neither given " + + "explicitly nor specified in the configuration): " + secConfPath); // Disable caching: - String prop = String.format("fs.%s.impl.disable.cache", secondaryFsUri.getScheme()); + String prop = String.format("fs.%s.impl.disable.cache", uri.getScheme()); cfg.setBoolean(prop, true); } @@ -88,7 +82,7 @@ public class SecondaryFileSystemProvider { * @throws IOException */ public FileSystem createFileSystem() throws IOException { - FileSystem fileSys = FileSystem.get(secondaryFsUri, cfg); + FileSystem fileSys = FileSystem.get(uri, cfg); return fileSys; } @@ -98,7 +92,7 @@ public class SecondaryFileSystemProvider { * @throws IOException */ public AbstractFileSystem createAbstractFileSystem() throws IOException { - AbstractFileSystem secondaryFs = AbstractFileSystem.get(secondaryFsUri, cfg); + AbstractFileSystem secondaryFs = AbstractFileSystem.get(uri, cfg); return secondaryFs; } @@ -106,7 +100,7 @@ public class SecondaryFileSystemProvider { /** * @return the secondary fs URI, never null. */ - public URI secondaryFsUri() { - return secondaryFsUri; + public URI uri() { + return uri; } }