ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-2206: Docs.
Date Mon, 04 Jan 2016 10:08:56 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-2206 493b29ddf -> 4b231539d


IGNITE-2206: Docs.


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

Branch: refs/heads/ignite-2206
Commit: 4b231539d9cae963bfd95fe42f01c403ee9fa134
Parents: 493b29d
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Jan 4 13:09:18 2016 +0400
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Jan 4 13:09:18 2016 +0400

----------------------------------------------------------------------
 .../org/apache/ignite/igfs/IgfsUserContext.java | 16 +++----
 .../hadoop/fs/HadoopFileSystemFactory.java      |  2 +
 .../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 49 ++++++++++++++------
 3 files changed, 44 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4b231539/modules/core/src/main/java/org/apache/ignite/igfs/IgfsUserContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsUserContext.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsUserContext.java
index 8db4e23..1e1cd31 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsUserContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsUserContext.java
@@ -34,24 +34,24 @@ public abstract class IgfsUserContext {
      * The main contract of this method is that {@link #currentUser()} method invoked
      * inside closure always returns 'user' this callable executed with.
      * @param user the user name to invoke closure on behalf of.
-     * @param clo the closure to execute
+     * @param c the closure to execute
      * @param <T> The type of closure result.
      * @return the result of closure execution.
      * @throws IllegalArgumentException if user name is null or empty String or if the closure
is null.
      */
-    public static <T> T doAs(String user, final IgniteOutClosure<T> clo) {
+    public static <T> T doAs(String user, final IgniteOutClosure<T> c) {
         if (F.isEmpty(user))
             throw new IllegalArgumentException("Failed to use null or empty user name.");
 
         final String ctxUser = userStackThreadLocal.get();
 
         if (F.eq(ctxUser, user))
-            return clo.apply(); // correct context is already there
+            return c.apply(); // correct context is already there
 
         userStackThreadLocal.set(user);
 
         try {
-            return clo.apply();
+            return c.apply();
         }
         finally {
             userStackThreadLocal.set(ctxUser);
@@ -81,24 +81,24 @@ public abstract class IgfsUserContext {
      *  }
      * </pre>
      * @param user the user name to invoke closure on behalf of.
-     * @param clbl the Callable to execute
+     * @param c the Callable to execute
      * @param <T> The type of callable result.
      * @return the result of closure execution.
      * @throws IllegalArgumentException if user name is null or empty String or if the closure
is null.
      */
-    public static <T> T doAs(String user, final Callable<T> clbl) throws Exception
{
+    public static <T> T doAs(String user, final Callable<T> c) throws Exception
{
         if (F.isEmpty(user))
             throw new IllegalArgumentException("Failed to use null or empty user name.");
 
         final String ctxUser = userStackThreadLocal.get();
 
         if (F.eq(ctxUser, user))
-            return clbl.call(); // correct context is already there
+            return c.call(); // correct context is already there
 
         userStackThreadLocal.set(user);
 
         try {
-            return clbl.call();
+            return c.call();
         }
         finally {
             userStackThreadLocal.set(ctxUser);

http://git-wip-us.apache.org/repos/asf/ignite/blob/4b231539/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
index 3298ddd..ae38cc4 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/HadoopFileSystemFactory.java
@@ -22,6 +22,8 @@ import java.io.Serializable;
 import org.apache.hadoop.fs.FileSystem;
 
 /**
+ * Factory for
+ *
  * Hadoop file system factory. Used to construct instance of {@link FileSystem} for Ignite.
  * <p>
  * Implementations may choose not to construct a new instance, but instead

http://git-wip-us.apache.org/repos/asf/ignite/blob/4b231539/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 98dc20e..d15a31e 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
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.hadoop.fs;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.ParentNotDirectoryException;
@@ -26,6 +27,7 @@ import org.apache.hadoop.fs.PathIsNotEmptyDirectoryException;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteFileSystem;
 import org.apache.ignite.igfs.IgfsDirectoryNotEmptyException;
 import org.apache.ignite.igfs.IgfsException;
 import org.apache.ignite.igfs.IgfsFile;
@@ -43,6 +45,7 @@ import org.apache.ignite.internal.processors.igfs.IgfsFileImpl;
 import org.apache.ignite.internal.processors.igfs.IgfsFileInfo;
 import org.apache.ignite.internal.processors.igfs.IgfsUtils;
 import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgniteOutClosure;
 import org.apache.ignite.lifecycle.LifecycleAware;
 import org.jetbrains.annotations.Nullable;
 
@@ -54,15 +57,16 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
+import java.util.concurrent.Callable;
 
 import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_GROUP_NAME;
 import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_PERMISSION;
 import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
 
 /**
- * Adapter to use any Hadoop file system {@link FileSystem} as {@link IgfsSecondaryFileSystem}.
- * In fact, this class deals with different FileSystems depending on the user context,
- * see {@link IgfsUserContext#currentUser()}.
+ * Secondary file system which delegates calls to an instance of Hadoop {@link FileSystem}.
+ * <p>
+ * Target {@code FileSystem}'s are created on per-user basis using passed {@link HadoopFileSystemFactory}.
  */
 public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem, LifecycleAware,
     HadoopPayloadAware {
@@ -84,6 +88,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      *
      * @param uri URI of file system.
      * @throws IgniteCheckedException In case of error.
+     * @deprecated Use {@link #getFileSystemFactory()} instead.
      */
     @Deprecated
     public IgniteHadoopIgfsSecondaryFileSystem(String uri) throws IgniteCheckedException
{
@@ -96,6 +101,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * @param uri URI of file system.
      * @param cfgPath Additional path to Hadoop configuration.
      * @throws IgniteCheckedException In case of error.
+     * @deprecated Use {@link #getFileSystemFactory()} instead.
      */
     @Deprecated
     public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath)
@@ -110,8 +116,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
      * @param cfgPath Additional path to Hadoop configuration.
      * @param usrName User name.
      * @throws IgniteCheckedException In case of error.
-     * @deprecated Arg-less constructor should be used instead, + setters. This constructor
is
-     *    supported for compatibility only.
+     * @deprecated Use {@link #getFileSystemFactory()} instead.
      */
     @Deprecated
     public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath,
@@ -129,36 +134,50 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
     }
 
     /**
-     * Gets the default user name.
+     * Gets default user name.
+     * <p>
+     * Defines user name which will be used during file system invocation in case no user
name is defined explicitly
+     * through {@link FileSystem#get(URI, Configuration, String)}.
+     * <p>
+     * Also this name will be used if you manipulate {@link IgniteFileSystem} directly and
do not set user name
+     * explicitly using {@link IgfsUserContext#doAs(String, IgniteOutClosure)} or
+     * {@link IgfsUserContext#doAs(String, Callable)} methods.
+     * <p>
+     * If not set value of system property {@code "user.name"} will be used. If this property
is not set either,
+     * {@code "anonymous"} will be used.
      *
-     * @return The default user name.
+     * @return Default user name.
      */
-    public String getDefaultUserName() {
+    @Nullable public String getDefaultUserName() {
         return dfltUsrName;
     }
 
     /**
-     * Sets the default user name.
+     * Sets default user name. See {@link #getDefaultUserName()} for details.
      *
-     * @param dfltUsrName The user name to set.
+     * @param dfltUsrName Default user name.
      */
-    public void setDefaultUserName(String dfltUsrName) {
+    public void setDefaultUserName(@Nullable String dfltUsrName) {
         this.dfltUsrName = dfltUsrName;
     }
 
     /**
-     * Gets the secondary file system factory.
+     * Gets secondary file system factory.
+     * <p>
+     * This factory will be used whenever a call to a target {@link FileSystem} is required.
+     * <p>
+     * If not set, {@link CachingHadoopFileSystemFactory} will be used.
      *
-     * @return The secondary file system factory.
+     * @return Secondary file system factory.
      */
     public HadoopFileSystemFactory getFileSystemFactory() {
         return fsFactory;
     }
 
     /**
-     * Sets secondary file system factory.
+     * Sets secondary file system factory. See {@link #getFileSystemFactory()} for details.
      *
-     * @param factory The factory to set.
+     * @param factory Secondary file system factory.
      */
     public void setFileSystemFactory(HadoopFileSystemFactory factory) {
         this.fsFactory = factory;


Mime
View raw message