You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/12/23 11:40:48 UTC
[06/12] ignite git commit: IGNITE-2206: intermadiate for review.
IGNITE-2206: intermadiate for review.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d12b9f12
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d12b9f12
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d12b9f12
Branch: refs/heads/ignite-2206
Commit: d12b9f1288103dc387080d84256d8b9b14ef5a6b
Parents: 4553562
Author: iveselovskiy <iv...@gridgain.com>
Authored: Tue Dec 22 18:18:13 2015 +0300
Committer: iveselovskiy <iv...@gridgain.com>
Committed: Tue Dec 22 18:18:13 2015 +0300
----------------------------------------------------------------------
.../igfs/secondary/IgfsSecondaryFileSystem.java | 31 +++--
.../processors/hadoop/PayloadAware.java | 4 +
.../processors/igfs/IgfsHandshakeResponse.java | 18 +--
.../internal/processors/igfs/IgfsImpl.java | 17 ++-
.../internal/processors/igfs/IgfsPaths.java | 128 ++++++++++---------
.../igfs/IgfsSecondaryFileSystemImpl.java | 20 ++-
.../visor/node/VisorIgfsConfiguration.java | 1 -
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 33 +++--
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 53 ++++----
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 17 +--
.../fs/DefaultHadoopFileSystemFactory.java | 6 +-
11 files changed, 163 insertions(+), 165 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
index 696c81a..354b0ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
@@ -21,7 +21,6 @@ import java.io.OutputStream;
import java.util.Collection;
import java.util.Map;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsFile;
import org.apache.ignite.igfs.IgfsPath;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Secondary file system interface.
*/
-public interface IgfsSecondaryFileSystem <F> {
+public interface IgfsSecondaryFileSystem {
/**
* Checks if the specified path exists.
*
@@ -194,20 +193,20 @@ public interface IgfsSecondaryFileSystem <F> {
*/
public long usedSpaceSize() throws IgniteException;
- /**
- * Gets the implementation specific properties of file system.
- *
- * @return Map of properties.
- * @deprecated Should not be used.
- */
- @Deprecated
- public Map<String,String> properties();
-
- /**
- *
- * @return The factory.
- */
- public @Nullable HadoopFileSystemFactory<F> getSecondaryFileSystemFactory();
+// /**
+// * Gets the implementation specific properties of file system.
+// *
+// * @return Map of properties.
+// * @deprecated Should not be used.
+// */
+// @Deprecated
+// public Map<String,String> properties();
+//
+// /**
+// *
+// * @return The factory.
+// */
+// public @Nullable HadoopFileSystemFactory<F> getSecondaryFileSystemFactory();
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/PayloadAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/PayloadAware.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/PayloadAware.java
index 24a8545..dc4ff5e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/PayloadAware.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/hadoop/PayloadAware.java
@@ -5,5 +5,9 @@ package org.apache.ignite.internal.processors.hadoop;
*/
public interface PayloadAware <P> {
+ /**
+ *
+ * @return
+ */
public P getPayload();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsHandshakeResponse.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsHandshakeResponse.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsHandshakeResponse.java
index 230f798..52cae8f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsHandshakeResponse.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsHandshakeResponse.java
@@ -36,9 +36,6 @@ public class IgfsHandshakeResponse implements Externalizable {
/** SECONDARY paths. */
private IgfsPaths paths;
- /** */
- private byte[] secondaryFileSystemFactoryBytes;
-
/** Server block size. */
private long blockSize;
@@ -58,12 +55,11 @@ public class IgfsHandshakeResponse implements Externalizable {
* @param paths Secondary paths.
* @param blockSize Server default block size.
*/
- public IgfsHandshakeResponse(String igfsName, IgfsPaths paths, byte[] secondaryFileSystemFactoryBytes,
+ public IgfsHandshakeResponse(String igfsName, IgfsPaths paths,
long blockSize, Boolean sampling) {
assert paths != null;
this.igfsName = igfsName;
- this.secondaryFileSystemFactoryBytes = secondaryFileSystemFactoryBytes;
this.paths = paths;
this.blockSize = blockSize;
this.sampling = sampling;
@@ -97,22 +93,12 @@ public class IgfsHandshakeResponse implements Externalizable {
return sampling;
}
- /**
- *
- * @return
- */
- public byte[] getSecondaryFileSystemFactoryBytes() {
- return secondaryFileSystemFactoryBytes;
- }
-
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
U.writeString(out, igfsName);
paths.writeExternal(out);
- U.writeByteArray(out, secondaryFileSystemFactoryBytes);
-
out.writeLong(blockSize);
if (sampling != null) {
@@ -131,8 +117,6 @@ public class IgfsHandshakeResponse implements Externalizable {
paths.readExternal(in);
- secondaryFileSystemFactoryBytes = U.readByteArray(in);
-
blockSize = in.readLong();
if (in.readBoolean())
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
index 15509ab..fb93ea1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.igfs;
import java.io.IOException;
import java.io.OutputStream;
+import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -72,6 +73,7 @@ import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.managers.communication.GridMessageListener;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
+import org.apache.ignite.internal.processors.hadoop.PayloadAware;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.GridSpinBusyLock;
import org.apache.ignite.internal.util.future.GridCompoundFuture;
@@ -87,6 +89,7 @@ import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteFuture;
import org.apache.ignite.lang.IgniteUuid;
+import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.resources.IgniteInstanceResource;
import org.apache.ignite.thread.IgniteThreadPoolExecutor;
import org.jetbrains.annotations.Nullable;
@@ -122,7 +125,7 @@ public final class IgfsImpl implements IgfsEx {
static final Map<String, String> DFLT_DIR_META = F.asMap(PROP_PERMISSION, PERMISSION_DFLT_VAL);
/** Handshake message. */
- private final IgfsPaths secondaryPaths;
+ private final IgfsPaths<Serializable> secondaryPaths;
/** Cache based structure (meta data) manager. */
private IgfsMetaManager meta;
@@ -200,6 +203,9 @@ public final class IgfsImpl implements IgfsEx {
data = igfsCtx.data();
secondaryFs = cfg.getSecondaryFileSystem();
+ if (secondaryFs instanceof LifecycleAware)
+ ((LifecycleAware) secondaryFs).start();
+
/* Default IGFS mode. */
IgfsMode dfltMode;
@@ -254,9 +260,16 @@ public final class IgfsImpl implements IgfsEx {
modeRslvr = new IgfsModeResolver(dfltMode, modes);
+ Serializable secondaryFsPayload = null;
+
+ if (secondaryFs instanceof PayloadAware) {
+ secondaryFsPayload = ((PayloadAware<Serializable>) secondaryFs).getPayload();
+ }
+
secondaryPaths = new IgfsPaths(
- secondaryFs == null ? null : secondaryFs.properties(),
+ //secondaryFs == null ? null : secondaryFs.properties(),
//secondaryFs == null ? null : secondaryFs.getSecondaryFileSystemFactory(),
+ secondaryFsPayload,
dfltMode,
modeRslvr.modesOrdered());
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
index a9813d0..d434d01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsPaths.java
@@ -25,12 +25,12 @@ import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-//import org.apache.ignite.igfs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.processors.hadoop.PayloadAware;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.jetbrains.annotations.Nullable;
@@ -38,16 +38,16 @@ import org.jetbrains.annotations.Nullable;
/**
* Description of path modes.
*/
-public class IgfsPaths <F> implements Externalizable {
+public class IgfsPaths <P extends Serializable> implements Externalizable, PayloadAware<P> {
/** */
private static final long serialVersionUID = 0L;
- /** Additional secondary file system properties. */
- @Deprecated
- private Map<String, String> props;
+// /** Additional secondary file system properties. */
+// @Deprecated
+// private Map<String, String> props;
-// /** */
-// private HadoopFileSystemFactory<F> factory;
+ /** */
+ private P payload;
/** Default IGFS mode. */
private IgfsMode dfltMode;
@@ -65,29 +65,28 @@ public class IgfsPaths <F> implements Externalizable {
/**
* Constructor.
*
- * @param props Additional secondary file system properties.
* @param dfltMode Default IGFS mode.
* @param pathModes Path modes.
*/
- public IgfsPaths(Map<String, String> props,
- //HadoopFileSystemFactory<F> factory,
+ public IgfsPaths(//Map<String, String> props,
+ P payload,
IgfsMode dfltMode,
@Nullable List<T2<IgfsPath, IgfsMode>> pathModes) {
- this.props = props;
- //this.factory = factory;
+ //this.props = props;
+ this.payload = payload;
this.dfltMode = dfltMode;
this.pathModes = pathModes;
}
- /**
- * @return Secondary file system properties.
- *
- * @deprecated
- */
- @Deprecated
- public Map<String, String> properties() {
- return props;
- }
+// /**
+// * @return Secondary file system properties.
+// *
+// * @deprecated
+// */
+// @Deprecated
+// public Map<String, String> properties() {
+// return props;
+// }
/**
* @return Default IGFS mode.
@@ -114,9 +113,9 @@ public class IgfsPaths <F> implements Externalizable {
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeStringMap(out, props);
+// U.writeStringMap(out, props);
-// writeFactory(out);
+ writePayload(out);
U.writeEnum(out, dfltMode);
@@ -133,30 +132,31 @@ public class IgfsPaths <F> implements Externalizable {
out.writeBoolean(false);
}
-// /**
-// *
-// * @param out
-// * @throws IOException
-// */
-// private void writeFactory(ObjectOutput out) throws IOException {
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-//
-// ObjectOutput oo = new ObjectOutputStream(baos);
-// try {
-// oo.writeObject(factory);
-// }
-// finally {
-// oo.close();
-// }
-//
-// U.writeByteArray(out, baos.toByteArray());
-// }
+ /**
+ *
+ * @param out
+ * @throws IOException
+ */
+ private void writePayload(ObjectOutput out) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ ObjectOutput oo = new ObjectOutputStream(baos);
+
+ try {
+ oo.writeObject(payload);
+ }
+ finally {
+ oo.close();
+ }
+
+ U.writeByteArray(out, baos.toByteArray());
+ }
/** {@inheritDoc} */
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- props = U.readStringMap(in);
+// props = U.readStringMap(in);
-// readFactory(in);
+ readPayload(in);
dfltMode = IgfsMode.fromOrdinal(in.readByte());
@@ -176,22 +176,26 @@ public class IgfsPaths <F> implements Externalizable {
}
}
-// /**
-// *
-// * @param in
-// * @throws IOException
-// * @throws ClassNotFoundException
-// */
-// private void readFactory(ObjectInput in) throws IOException, ClassNotFoundException {
-// byte[] factoryBytes = U.readByteArray(in);
-//
-// ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(factoryBytes));
-//
-// try {
-// factory = (HadoopFileSystemFactory<F>) oi.readObject();
-// }
-// finally {
-// oi.close();
-// }
-// }
+ /**
+ *
+ * @param in
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readPayload(ObjectInput in) throws IOException, ClassNotFoundException {
+ byte[] factoryBytes = U.readByteArray(in);
+
+ ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(factoryBytes));
+
+ try {
+ payload = (P) oi.readObject();
+ }
+ finally {
+ oi.close();
+ }
+ }
+
+ @Override public P getPayload() {
+ return payload;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryFileSystemImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryFileSystemImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryFileSystemImpl.java
index 1b1ce24..ced6b21 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryFileSystemImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsSecondaryFileSystemImpl.java
@@ -19,10 +19,8 @@ package org.apache.ignite.internal.processors.igfs;
import java.io.OutputStream;
import java.util.Collection;
-import java.util.Collections;
import java.util.Map;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsFile;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
@@ -32,7 +30,7 @@ import org.jetbrains.annotations.Nullable;
/**
* Secondary file system over native IGFS.
*/
-class IgfsSecondaryFileSystemImpl implements IgfsSecondaryFileSystem <IgfsEx> {
+class IgfsSecondaryFileSystemImpl implements IgfsSecondaryFileSystem {
/** Delegate. */
private final IgfsEx igfs;
@@ -118,18 +116,18 @@ class IgfsSecondaryFileSystemImpl implements IgfsSecondaryFileSystem <IgfsEx> {
return igfs.usedSpaceSize();
}
- /** {@inheritDoc} */
- @Override public Map<String, String> properties() {
- return Collections.emptyMap();
- }
+// /** {@inheritDoc} */
+// @Override public Map<String, String> properties() {
+// return Collections.emptyMap();
+// }
/** {@inheritDoc} */
@Override public void close() throws IgniteException {
// No-op.
}
- /** {@inheritDoc} */
- @Override public HadoopFileSystemFactory<IgfsEx> getSecondaryFileSystemFactory() {
- return null;
- }
+// /** {@inheritDoc} */
+// @Override public HadoopFileSystemFactory<IgfsEx> getSecondaryFileSystemFactory() {
+// return null;
+// }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/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 08792a4..2238fdf 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
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import org.apache.ignite.configuration.FileSystemConfiguration;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsIpcEndpointConfiguration;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/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 f8c7f3a..7ba136b 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
@@ -21,7 +21,6 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -36,7 +35,6 @@ 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.igfs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsDirectoryNotEmptyException;
import org.apache.ignite.igfs.IgfsException;
import org.apache.ignite.igfs.IgfsFile;
@@ -47,6 +45,7 @@ import org.apache.ignite.igfs.IgfsPathNotFoundException;
import org.apache.ignite.igfs.IgfsUserContext;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystem;
import org.apache.ignite.igfs.secondary.IgfsSecondaryFileSystemPositionedReadable;
+import org.apache.ignite.internal.processors.hadoop.PayloadAware;
import org.apache.ignite.internal.processors.hadoop.fs.DefaultHadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsProperties;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsSecondaryFileSystemPositionedReadable;
@@ -57,7 +56,6 @@ import org.apache.ignite.internal.util.typedef.F;
import static org.apache.ignite.internal.util.typedef.F.*;
import org.apache.ignite.internal.util.typedef.internal.A;
-import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lifecycle.LifecycleAware;
import org.jetbrains.annotations.Nullable;
@@ -70,7 +68,8 @@ import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
* In fact, this class deals with different FileSystems depending on the user context,
* see {@link IgfsUserContext#currentUser()}.
*/
-public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem <FileSystem> {
+public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSystem,
+ LifecycleAware, PayloadAware<HadoopFileSystemFactory<FileSystem>> {
// /** Properties of file system, see {@link #properties()}
// * */
// private final Map<String, String> props = new HashMap<>();
@@ -533,10 +532,10 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
}
}
- /** {@inheritDoc} */
- @Override public Map<String, String> properties() {
- return Collections.emptyMap();
- }
+// /** {@inheritDoc} */
+// @Override public Map<String, String> properties() {
+// return Collections.emptyMap();
+// }
/** {@inheritDoc} */
@Override public void close() throws IgniteException {
@@ -589,7 +588,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
if (F.eq(user, dfltUserName))
return dfltFs; // optimization
- assert fsFactory.uri() != null : "uri!";
+ //assert fsFactory.uri() != null : "uri!";
try {
return fsFactory.get(user);
@@ -605,7 +604,7 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
*
* @throws IgniteCheckedException
*/
- public void start() throws IgniteCheckedException {
+ @Override public void start() {
// #start() should not ever be invoked if these properties are not set:
A.ensure(fsFactory != null, "factory");
A.ensure(dfltUserName != null, "dfltUserName");
@@ -625,13 +624,21 @@ public class IgniteHadoopIgfsSecondaryFileSystem implements IgfsSecondaryFileSys
assert dfltFs != null;
}
catch (IOException e) {
- throw new IgniteCheckedException(e);
+ throw new IgniteException(e);
}
}
}
- /** {@inheritDoc} */
- @Nullable @Override public HadoopFileSystemFactory<FileSystem> getSecondaryFileSystemFactory() {
+// /** {@inheritDoc} */
+// @Nullable @Override public HadoopFileSystemFactory<FileSystem> getSecondaryFileSystemFactory() {
+// return fsFactory;
+// }
+
+ @Override public void stop() throws IgniteException {
+ close();
+ }
+
+ @Override public HadoopFileSystemFactory<FileSystem> getPayload() {
return fsFactory;
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
index 20e2011..932e326 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v1/IgniteHadoopFileSystem.java
@@ -47,7 +47,7 @@ import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.Progressable;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
+import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsBlockLocation;
import org.apache.ignite.igfs.IgfsException;
import org.apache.ignite.igfs.IgfsFile;
@@ -295,7 +295,7 @@ public class IgniteHadoopFileSystem extends FileSystem {
igfsGrpBlockSize = handshake.blockSize();
- final IgfsPaths<FileSystem> paths = handshake.secondaryPaths();
+ final IgfsPaths<HadoopFileSystemFactory<FileSystem>> paths = handshake.secondaryPaths();
// Initialize client logger.
Boolean logEnabled = parameter(cfg, PARAM_IGFS_LOG_ENABLED, uriAuthority, false);
@@ -334,26 +334,24 @@ public class IgniteHadoopFileSystem extends FileSystem {
// String secUri = props.get(SECONDARY_FS_URI);
// String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH);
- byte[] secFsFacoryBytes = handshake.getSecondaryFileSystemFactoryBytes();
+// byte[] secFsFacoryBytes = handshake.getSecondaryFileSystemFactoryBytes();
-
-
- //HadoopFileSystemFactory<FileSystem> factory = paths.factory();
+ HadoopFileSystemFactory<FileSystem> factory = paths.getPayload();
A.ensure(factory != null, "Secondary file system factory should not be null.");
- secondaryUri = factory.uri();
-
- A.ensure(secondaryUri != null, "Secondary file system uri should not be null.");
+ //secondaryUri = factory.uri();
try {
//SecondaryFileSystemProvider secProvider = new SecondaryFileSystemProvider(secUri, secConfPath);
secondaryFs = factory.get(user); //secProvider.createFileSystem(user);
- URI uri2 = secondaryFs.getUri();
+ secondaryUri = secondaryFs.getUri();
+
+ A.ensure(secondaryUri != null, "Secondary file system uri should not be null.");
- assert secondaryUri.equals(uri2);
+ //assert secondaryUri.equals(uri2);
}
catch (IOException e) {
if (!mgmt)
@@ -372,23 +370,22 @@ public class IgniteHadoopFileSystem extends FileSystem {
}
}
- /**
- *
- * @param in
- * @throws IOException
- * @throws ClassNotFoundException
- */
- static HadoopFileSystemFactory readFactory(byte[] factoryBytes) throws IOException, ClassNotFoundException {
- ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(factoryBytes));
-
- try {
- return (HadoopFileSystemFactory<F>) oi.readObject();
- }
- finally {
- oi.close();
- }
- }
-
+// /**
+// *
+// * @param in
+// * @throws IOException
+// * @throws ClassNotFoundException
+// */
+// static HadoopFileSystemFactory readFactory(byte[] factoryBytes) throws IOException, ClassNotFoundException {
+// ObjectInput oi = new ObjectInputStream(new ByteArrayInputStream(factoryBytes));
+//
+// try {
+// return (HadoopFileSystemFactory<F>) oi.readObject();
+// }
+// finally {
+// oi.close();
+// }
+// }
/** {@inheritDoc} */
@Override protected void checkPath(Path path) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
index ae97464..d3267c7 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/hadoop/fs/v2/IgniteHadoopFileSystem.java
@@ -52,13 +52,12 @@ import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.util.DataChecksum;
import org.apache.hadoop.util.Progressable;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
+import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.igfs.IgfsBlockLocation;
import org.apache.ignite.igfs.IgfsFile;
import org.apache.ignite.igfs.IgfsMode;
import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.internal.igfs.common.IgfsLogger;
-import org.apache.ignite.internal.processors.hadoop.fs.DefaultHadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsEndpoint;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsInputStream;
import org.apache.ignite.internal.processors.hadoop.igfs.HadoopIgfsOutputStream;
@@ -93,8 +92,6 @@ 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_PREFER_LOCAL_WRITES;
import static org.apache.ignite.internal.processors.igfs.IgfsEx.PROP_USER_NAME;
-//import static org.apache.ignite.internal.processors.igfs.IgfsEx.SECONDARY_FS_CONFIG_PATH;
-//import static org.apache.ignite.internal.processors.igfs.IgfsEx.SECONDARY_FS_URI;
/**
* {@code IGFS} Hadoop 2.x file system driver over file system API. To use
@@ -303,7 +300,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
grpBlockSize = handshake.blockSize();
- IgfsPaths<AbstractFileSystem> paths = handshake.secondaryPaths();
+ IgfsPaths<HadoopFileSystemFactory<AbstractFileSystem>> paths = handshake.secondaryPaths();
Boolean logEnabled = parameter(cfg, PARAM_IGFS_LOG_ENABLED, uriAuthority, false);
@@ -342,7 +339,7 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
// String secConfPath = props.get(SECONDARY_FS_CONFIG_PATH);
HadoopFileSystemFactory<AbstractFileSystem> factory
- = (HadoopFileSystemFactory<AbstractFileSystem>)paths.factory();
+ = (HadoopFileSystemFactory<AbstractFileSystem>)paths.getPayload();
A.ensure(secondaryUri != null, "File system factory uri should not be null.");
@@ -355,10 +352,10 @@ public class IgniteHadoopFileSystem extends AbstractFileSystem implements Closea
secondaryUri = secondaryFs.getUri();
- assert secondaryUri != null;
-
- URI uri2 = ((DefaultHadoopFileSystemFactory)factory).uri();
- assert secondaryUri.equals(uri2);
+// assert secondaryUri != null;
+//
+// URI uri2 = ((DefaultHadoopFileSystemFactory)factory).uri();
+// assert secondaryUri.equals(uri2);
//secondaryFs = secProvider.createAbstractFileSystem(user);
//secondaryUri = secProvider.uri();
http://git-wip-us.apache.org/repos/asf/ignite/blob/d12b9f12/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/DefaultHadoopFileSystemFactory.java
----------------------------------------------------------------------
diff --git a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/DefaultHadoopFileSystemFactory.java b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/DefaultHadoopFileSystemFactory.java
index 0b93cba..bee0f25 100644
--- a/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/DefaultHadoopFileSystemFactory.java
+++ b/modules/hadoop/src/main/java/org/apache/ignite/internal/processors/hadoop/fs/DefaultHadoopFileSystemFactory.java
@@ -12,7 +12,7 @@ import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
-import org.apache.ignite.igfs.HadoopFileSystemFactory;
+import org.apache.ignite.hadoop.fs.HadoopFileSystemFactory;
import org.apache.ignite.internal.processors.hadoop.HadoopUtils;
import org.apache.ignite.internal.processors.igfs.IgfsPaths;
import org.apache.ignite.internal.processors.igfs.IgfsUtils;
@@ -75,10 +75,6 @@ public class DefaultHadoopFileSystemFactory implements HadoopFileSystemFactory<F
}
}
- @Override public URI uri() {
- return uri;
- }
-
/**
* Configuration(s) setter, to be invoked from Spring config.
* @param cfgPaths