ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [1/2] incubator-ignite git commit: [GG-9961]: initial commit.
Date Tue, 24 Mar 2015 08:26:05 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-gg-9961 [created] fd0747eb2


[GG-9961]: initial commit.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/475fbf1c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/475fbf1c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/475fbf1c

Branch: refs/heads/ignite-gg-9961
Commit: 475fbf1c8efa0d27c4e2e4b7f8ada5f7b7f6653d
Parents: d578683
Author: iveselovskiy <iveselovskiy@gridgain.com>
Authored: Tue Mar 24 11:21:58 2015 +0300
Committer: iveselovskiy <iveselovskiy@gridgain.com>
Committed: Tue Mar 24 11:21:58 2015 +0300

----------------------------------------------------------------------
 .../fs/IgniteHadoopIgfsSecondaryFileSystem.java  | 16 ++++++++++++----
 .../internal/processors/hadoop/HadoopSetup.java  |  8 ++++----
 .../hadoop/SecondaryFileSystemProvider.java      | 19 +++++++++++++++----
 3 files changed, 31 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/475fbf1c/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
index 6d0c386..a00e1eb 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/IgniteHadoopIgfsSecondaryFileSystem.java
@@ -53,7 +53,12 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * @throws IgniteCheckedException In case of error.
      */
     public IgniteHadoopIgfsSecondaryFileSystem(String uri) throws IgniteCheckedException
{
-        this(uri, null);
+        this(uri, null, null);
+    }
+
+    public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath)
+        throws IgniteCheckedException {
+        this(uri, cfgPath, null);
     }
 
     /**
@@ -63,14 +68,17 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * @param cfgPath Additional path to Hadoop configuration.
      * @throws IgniteCheckedException In case of error.
      */
-    public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath)
+    public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath,
@Nullable String userName)
             throws IgniteCheckedException {
         // Treat empty uri argument as null to improve configuration usability:
         if (F.isEmpty(uri))
             uri = null;
 
+        if (F.isEmpty(userName))
+            userName = null;
+
         try {
-            SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(uri,
cfgPath);
+            SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(uri,
cfgPath, userName);
 
             fileSys = secProvider.createFileSystem();
 
@@ -84,7 +92,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
 
             props.put(SECONDARY_FS_URI, uri);
         }
-        catch (IOException e) {
+        catch (IOException | InterruptedException e) {
             throw new IgniteCheckedException(e);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/475fbf1c/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSetup.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSetup.java
b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSetup.java
index c33c1f1..80c22fc 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSetup.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/HadoopSetup.java
@@ -113,7 +113,7 @@ public class HadoopSetup {
         if (!hadoopDir.canRead())
             exit("Hadoop installation folder can not be read. Please check permissions.",
null);
 
-        File hadoopCommonDir;
+        final File hadoopCommonDir;
 
         String hadoopCommonHome = System.getenv("HADOOP_COMMON_HOME");
 
@@ -129,9 +129,9 @@ public class HadoopSetup {
         }
 
         if (!hadoopCommonDir.canRead())
-            exit("Failed to read Hadoop common dir in '" + hadoopCommonHome + "'.", null);
+            exit("Failed to read Hadoop common dir '" + hadoopCommonDir + "'.", null);
 
-        File hadoopCommonLibDir = new File(hadoopCommonDir, "lib");
+        final File hadoopCommonLibDir = new File(hadoopCommonDir, "lib");
 
         if (!hadoopCommonLibDir.canRead())
             exit("Failed to read Hadoop 'lib' folder in '" + hadoopCommonLibDir.getPath()
+ "'.", null);
@@ -139,7 +139,7 @@ public class HadoopSetup {
         if (U.isWindows()) {
             checkJavaPathSpaces();
 
-            File hadoopBinDir = new File(hadoopDir, "bin");
+            final File hadoopBinDir = new File(hadoopDir, "bin");
 
             if (!hadoopBinDir.canRead())
                 exit("Failed to read subdirectory 'bin' in HADOOP_HOME.", null);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/475fbf1c/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 c1dceba..38dab0c 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
@@ -36,6 +36,9 @@ public class SecondaryFileSystemProvider {
     /** The secondary filesystem URI, never null. */
     private final URI uri;
 
+    /** Optional user name to log into secondary filesystem with. */
+    private @Nullable final String userName;
+
     /**
      * Creates new provider with given config parameters. The configuration URL is optional.
The filesystem URI must be
      * specified either explicitly or in the configuration provided.
@@ -47,7 +50,9 @@ public class SecondaryFileSystemProvider {
      * @throws IOException
      */
     public SecondaryFileSystemProvider(final @Nullable String secUri,
-        final @Nullable String secConfPath) throws IOException {
+        final @Nullable String secConfPath, @Nullable String userName) throws IOException
{
+        this.userName = userName;
+
         if (secConfPath != null) {
             URL url = U.resolveIgniteUrl(secConfPath);
 
@@ -86,8 +91,13 @@ public class SecondaryFileSystemProvider {
      * @return {@link org.apache.hadoop.fs.FileSystem}  instance for this secondary Fs.
      * @throws IOException
      */
-    public FileSystem createFileSystem() throws IOException {
-        FileSystem fileSys = FileSystem.get(uri, cfg);
+    public FileSystem createFileSystem() throws IOException, InterruptedException {
+        final FileSystem fileSys;
+
+        if (userName == null)
+            fileSys = FileSystem.get(uri, cfg);
+        else
+            fileSys = FileSystem.get(uri, cfg, userName);
 
         return fileSys;
     }
@@ -97,7 +107,8 @@ public class SecondaryFileSystemProvider {
      * @throws IOException
      */
     public AbstractFileSystem createAbstractFileSystem() throws IOException {
-        AbstractFileSystem secondaryFs = AbstractFileSystem.get(uri, cfg);
+        // TODO: how to use userName in this case?
+        final AbstractFileSystem secondaryFs = AbstractFileSystem.get(uri, cfg);
 
         return secondaryFs;
     }


Mime
View raw message