# Renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/f3d93762 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/f3d93762 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/f3d93762 Branch: refs/heads/master Commit: f3d9376217eb3817cbd0d57c94517da9b6ce5594 Parents: 1515c5a Author: sboikov <sboi...@gridgain.com> Authored: Fri Dec 5 11:13:21 2014 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri Dec 5 11:13:23 2014 +0300 ---------------------------------------------------------------------- .../org/gridgain/examples/ggfs/GgfsExample.java | 24 +- .../examples/ggfs/GgfsMapReduceExample.java | 8 +- .../main/java/org/apache/ignite/IgniteFs.java | 34 +-- .../org/apache/ignite/events/IgniteFsEvent.java | 16 +- .../GridCacheGgfsPerBlockLruEvictionPolicy.java | 2 +- .../grid/ggfs/GridGgfsBlockLocation.java | 55 ---- ...GridGgfsConcurrentModificationException.java | 2 +- .../org/gridgain/grid/ggfs/GridGgfsFile.java | 4 +- .../gridgain/grid/ggfs/GridGgfsFileSystem.java | 26 +- .../gridgain/grid/ggfs/GridGgfsInputStream.java | 2 +- .../org/gridgain/grid/ggfs/GridGgfsPath.java | 254 ------------------- .../GridGgfsPathAlreadyExistsException.java | 42 --- .../gridgain/grid/ggfs/GridGgfsPathSummary.java | 130 ---------- .../org/gridgain/grid/ggfs/GridGgfsReader.java | 30 --- .../grid/ggfs/IgniteFsBlockLocation.java | 55 ++++ .../org/gridgain/grid/ggfs/IgniteFsPath.java | 254 +++++++++++++++++++ .../IgniteFsPathAlreadyExistsException.java | 42 +++ .../gridgain/grid/ggfs/IgniteFsPathSummary.java | 130 ++++++++++ .../org/gridgain/grid/ggfs/IgniteFsReader.java | 30 +++ .../grid/ggfs/mapreduce/GridGgfsFileRange.java | 6 +- .../grid/ggfs/mapreduce/GridGgfsTask.java | 10 +- .../grid/ggfs/mapreduce/GridGgfsTaskArgs.java | 4 +- .../ggfs/common/GridGgfsControlResponse.java | 22 +- .../grid/kernal/ggfs/common/GridGgfsLogger.java | 14 +- .../kernal/ggfs/common/GridGgfsMarshaller.java | 8 +- .../ggfs/common/GridGgfsPathControlRequest.java | 12 +- .../processors/ggfs/GridGgfsAsyncImpl.java | 54 ++-- .../ggfs/GridGgfsBlockLocationImpl.java | 4 +- .../processors/ggfs/GridGgfsDataManager.java | 20 +- .../grid/kernal/processors/ggfs/GridGgfsEx.java | 8 +- .../processors/ggfs/GridGgfsFileImpl.java | 10 +- .../processors/ggfs/GridGgfsFileInfo.java | 8 +- .../ggfs/GridGgfsFileWorkerBatch.java | 6 +- .../kernal/processors/ggfs/GridGgfsImpl.java | 134 +++++----- .../ggfs/GridGgfsInputStreamImpl.java | 8 +- .../kernal/processors/ggfs/GridGgfsJobImpl.java | 4 +- .../processors/ggfs/GridGgfsMetaManager.java | 116 ++++----- .../processors/ggfs/GridGgfsModeResolver.java | 28 +- .../ggfs/GridGgfsOutputStreamAdapter.java | 4 +- .../ggfs/GridGgfsOutputStreamImpl.java | 2 +- .../kernal/processors/ggfs/GridGgfsPaths.java | 12 +- .../processors/ggfs/GridGgfsProcessor.java | 2 +- .../ggfs/GridGgfsProcessorAdapter.java | 2 +- .../GridGgfsSecondaryInputStreamDescriptor.java | 6 +- .../processors/ggfs/GridGgfsTaskArgsImpl.java | 6 +- .../processors/ggfs/GridNoopGgfsProcessor.java | 2 +- .../ggfs/GridGgfsEventsAbstractSelfTest.java | 142 +++++------ .../GridGgfsFragmentizerAbstractSelfTest.java | 2 +- .../grid/ggfs/GridGgfsFragmentizerSelfTest.java | 10 +- .../GridGgfsFragmentizerTopologySelfTest.java | 2 +- .../grid/ggfs/GridGgfsPathSelfTest.java | 32 +-- ...heGgfsPerBlockLruEvictionPolicySelfTest.java | 8 +- .../ggfs/GridGgfsAbstractSelfTest.java | 146 +++++------ .../ggfs/GridGgfsDataManagerSelfTest.java | 28 +- .../ggfs/GridGgfsDualAbstractSelfTest.java | 100 ++++---- .../ggfs/GridGgfsMetaManagerSelfTest.java | 66 ++--- .../ggfs/GridGgfsMetricsSelfTest.java | 34 +-- .../ggfs/GridGgfsModeResolverSelfTest.java | 36 +-- .../processors/ggfs/GridGgfsModesSelfTest.java | 6 +- .../ggfs/GridGgfsProcessorSelfTest.java | 48 ++-- .../processors/ggfs/GridGgfsSizeSelfTest.java | 16 +- .../ggfs/GridGgfsStreamsSelfTest.java | 22 +- .../processors/ggfs/GridGgfsTaskSelfTest.java | 4 +- .../GridGgfsAbstractRecordResolverSelfTest.java | 2 +- .../hadoop/v1/GridGgfsHadoopFileSystem.java | 38 +-- .../hadoop/v2/GridGgfsHadoopFileSystem.java | 34 +-- .../grid/kernal/ggfs/hadoop/GridGgfsHadoop.java | 28 +- .../hadoop/GridGgfsHadoopFileSystemWrapper.java | 38 +-- .../ggfs/hadoop/GridGgfsHadoopInProc.java | 28 +- .../ggfs/hadoop/GridGgfsHadoopOutProc.java | 34 +-- .../ggfs/hadoop/GridGgfsHadoopReader.java | 2 +- .../kernal/ggfs/hadoop/GridGgfsHadoopUtils.java | 2 +- .../ggfs/hadoop/GridGgfsHadoopWrapper.java | 42 +-- .../GridHadoopDefaultMapReducePlanner.java | 4 +- .../GridHadoopClientProtocolSelfTest.java | 14 +- ...dGgfsHadoop20FileSystemAbstractSelfTest.java | 6 +- .../GridGgfsHadoopDualAbstractSelfTest.java | 8 +- ...ridGgfsHadoopFileSystemAbstractSelfTest.java | 6 +- .../GridGgfsHadoopFileSystemClientSelfTest.java | 2 +- ...idGgfsHadoopFileSystemHandshakeSelfTest.java | 2 +- .../GridGgfsHadoopFileSystemLoggerSelfTest.java | 6 +- .../hadoop/GridHadoopAbstractWordCountTest.java | 4 +- .../hadoop/GridHadoopCommandLineTest.java | 14 +- ...idHadoopDefaultMapReducePlannerSelfTest.java | 68 ++--- .../GridHadoopMapReduceEmbeddedSelfTest.java | 6 +- .../hadoop/GridHadoopMapReduceTest.java | 8 +- .../hadoop/GridHadoopTaskExecutionSelfTest.java | 2 +- .../hadoop/GridHadoopTasksAllVersionsTest.java | 8 +- ...GridHadoopExternalTaskExecutionSelfTest.java | 2 +- 89 files changed, 1381 insertions(+), 1381 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/examples/src/main/java/org/gridgain/examples/ggfs/GgfsExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/ggfs/GgfsExample.java b/examples/src/main/java/org/gridgain/examples/ggfs/GgfsExample.java index 21e30e2..307d582 100644 --- a/examples/src/main/java/org/gridgain/examples/ggfs/GgfsExample.java +++ b/examples/src/main/java/org/gridgain/examples/ggfs/GgfsExample.java @@ -46,7 +46,7 @@ public final class GgfsExample { IgniteFs fs = g.fileSystem("ggfs"); // Working directory path. - GridGgfsPath workDir = new GridGgfsPath("/examples/ggfs"); + IgniteFsPath workDir = new IgniteFsPath("/examples/ggfs"); // Cleanup working directory. delete(fs, workDir); @@ -58,7 +58,7 @@ public final class GgfsExample { printInfo(fs, workDir); // File path. - GridGgfsPath filePath = new GridGgfsPath(workDir, "file.txt"); + IgniteFsPath filePath = new IgniteFsPath(workDir, "file.txt"); // Create file. create(fs, filePath, new byte[] {1, 2, 3}); @@ -83,7 +83,7 @@ public final class GgfsExample { // Create several files. for (int i = 0; i < 5; i++) - create(fs, new GridGgfsPath(workDir, "file-" + i + ".txt"), null); + create(fs, new IgniteFsPath(workDir, "file-" + i + ".txt"), null); list(fs, workDir); } @@ -100,7 +100,7 @@ public final class GgfsExample { * @param path File or directory path. * @throws GridException In case of error. */ - private static void delete(IgniteFs fs, GridGgfsPath path) throws GridException { + private static void delete(IgniteFs fs, IgniteFsPath path) throws GridException { assert fs != null; assert path != null; @@ -132,7 +132,7 @@ public final class GgfsExample { * @param path Directory path. * @throws GridException In case of error. */ - private static void mkdirs(IgniteFs fs, GridGgfsPath path) throws GridException { + private static void mkdirs(IgniteFs fs, IgniteFsPath path) throws GridException { assert fs != null; assert path != null; @@ -159,7 +159,7 @@ public final class GgfsExample { * @throws GridException If file can't be created. * @throws IOException If data can't be written. */ - private static void create(IgniteFs fs, GridGgfsPath path, @Nullable byte[] data) + private static void create(IgniteFs fs, IgniteFsPath path, @Nullable byte[] data) throws GridException, IOException { assert fs != null; assert path != null; @@ -188,7 +188,7 @@ public final class GgfsExample { * @throws GridException If file can't be created. * @throws IOException If data can't be written. */ - private static void append(IgniteFs fs, GridGgfsPath path, byte[] data) throws GridException, IOException { + private static void append(IgniteFs fs, IgniteFsPath path, byte[] data) throws GridException, IOException { assert fs != null; assert path != null; assert data != null; @@ -213,7 +213,7 @@ public final class GgfsExample { * @throws GridException If file can't be opened. * @throws IOException If data can't be read. */ - private static void read(IgniteFs fs, GridGgfsPath path) throws GridException, IOException { + private static void read(IgniteFs fs, IgniteFsPath path) throws GridException, IOException { assert fs != null; assert path != null; assert fs.info(path).isFile(); @@ -235,12 +235,12 @@ public final class GgfsExample { * @param path Directory path. * @throws GridException In case of error. */ - private static void list(IgniteFs fs, GridGgfsPath path) throws GridException { + private static void list(IgniteFs fs, IgniteFsPath path) throws GridException { assert fs != null; assert path != null; assert fs.info(path).isDirectory(); - Collection<GridGgfsPath> files = fs.listPaths(path); + Collection<IgniteFsPath> files = fs.listPaths(path); if (files.isEmpty()) { System.out.println(); @@ -250,7 +250,7 @@ public final class GgfsExample { System.out.println(); System.out.println(">>> List of files in directory: " + path); - for (GridGgfsPath f : files) + for (IgniteFsPath f : files) System.out.println(">>> " + f.name()); } @@ -264,7 +264,7 @@ public final class GgfsExample { * @param path File or directory path. * @throws GridException In case of error. */ - private static void printInfo(IgniteFs fs, GridGgfsPath path) throws GridException { + private static void printInfo(IgniteFs fs, IgniteFsPath path) throws GridException { System.out.println(); System.out.println("Information for " + path + ": " + fs.info(path)); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/examples/src/main/java/org/gridgain/examples/ggfs/GgfsMapReduceExample.java ---------------------------------------------------------------------- diff --git a/examples/src/main/java/org/gridgain/examples/ggfs/GgfsMapReduceExample.java b/examples/src/main/java/org/gridgain/examples/ggfs/GgfsMapReduceExample.java index cddd30b..89dbbe8 100644 --- a/examples/src/main/java/org/gridgain/examples/ggfs/GgfsMapReduceExample.java +++ b/examples/src/main/java/org/gridgain/examples/ggfs/GgfsMapReduceExample.java @@ -57,10 +57,10 @@ public class GgfsMapReduceExample { IgniteFs fs = g.fileSystem("ggfs"); // Working directory path. - GridGgfsPath workDir = new GridGgfsPath("/examples/ggfs"); + IgniteFsPath workDir = new IgniteFsPath("/examples/ggfs"); // Write file to GGFS. - GridGgfsPath fsPath = new GridGgfsPath(workDir, file.getName()); + IgniteFsPath fsPath = new IgniteFsPath(workDir, file.getName()); writeFile(fs, fsPath, file); @@ -87,7 +87,7 @@ public class GgfsMapReduceExample { * @param file File to write. * @throws Exception In case of exception. */ - private static void writeFile(IgniteFs fs, GridGgfsPath fsPath, File file) throws Exception { + private static void writeFile(IgniteFs fs, IgniteFsPath fsPath, File file) throws Exception { System.out.println(); System.out.println("Copying file to GGFS: " + file); @@ -121,7 +121,7 @@ public class GgfsMapReduceExample { */ private static class GrepTask extends GridGgfsTask<String, Collection<Line>> { /** {@inheritDoc} */ - @Override public GridGgfsJob createJob(GridGgfsPath path, GridGgfsFileRange range, + @Override public GridGgfsJob createJob(IgniteFsPath path, GridGgfsFileRange range, GridGgfsTaskArgs<String> args) throws GridException { return new GrepJob(args.userArgument()); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/apache/ignite/IgniteFs.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFs.java b/modules/core/src/main/java/org/apache/ignite/IgniteFs.java index 8a36d49..d50afd2 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteFs.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteFs.java @@ -78,7 +78,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridGgfsFileNotFoundException If path is not found. * @throws GridException If failed. */ - public GridGgfsPathSummary summary(GridGgfsPath path) throws GridException; + public IgniteFsPathSummary summary(IgniteFsPath path) throws GridException; /** * Opens a file for reading. @@ -88,7 +88,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public GridGgfsInputStream open(GridGgfsPath path) throws GridException; + public GridGgfsInputStream open(IgniteFsPath path) throws GridException; /** * Opens a file for reading. @@ -99,7 +99,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - @Override public GridGgfsInputStream open(GridGgfsPath path, int bufSize) throws GridException; + @Override public GridGgfsInputStream open(IgniteFsPath path, int bufSize) throws GridException; /** * Opens a file for reading. @@ -111,7 +111,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public GridGgfsInputStream open(GridGgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws GridException; + public GridGgfsInputStream open(IgniteFsPath path, int bufSize, int seqReadsBeforePrefetch) throws GridException; /** * Creates a file and opens it for writing. @@ -121,7 +121,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @return File output stream to write data to. * @throws GridException In case of error. */ - @Override public GridGgfsOutputStream create(GridGgfsPath path, boolean overwrite) throws GridException; + @Override public GridGgfsOutputStream create(IgniteFsPath path, boolean overwrite) throws GridException; /** * Creates a file and opens it for writing. @@ -135,7 +135,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @return File output stream to write data to. * @throws GridException In case of error. */ - @Override public GridGgfsOutputStream create(GridGgfsPath path, int bufSize, boolean overwrite, int replication, + @Override public GridGgfsOutputStream create(IgniteFsPath path, int bufSize, boolean overwrite, int replication, long blockSize, @Nullable Map<String, String> props) throws GridException; /** @@ -152,7 +152,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @return File output stream to write data to. * @throws GridException In case of error. */ - public GridGgfsOutputStream create(GridGgfsPath path, int bufSize, boolean overwrite, + public GridGgfsOutputStream create(IgniteFsPath path, int bufSize, boolean overwrite, @Nullable IgniteUuid affKey, int replication, long blockSize, @Nullable Map<String, String> props) throws GridException; @@ -165,7 +165,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. */ - public GridGgfsOutputStream append(GridGgfsPath path, boolean create) throws GridException; + public GridGgfsOutputStream append(IgniteFsPath path, boolean create) throws GridException; /** * Opens an output stream to an existing file for appending data. @@ -178,7 +178,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. */ - @Override public GridGgfsOutputStream append(GridGgfsPath path, int bufSize, boolean create, + @Override public GridGgfsOutputStream append(IgniteFsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) throws GridException; /** @@ -192,7 +192,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridGgfsFileNotFoundException If target was not found. * @throws GridException If error occurred. */ - public void setTimes(GridGgfsPath path, long accessTime, long modificationTime) throws GridException; + public void setTimes(IgniteFsPath path, long accessTime, long modificationTime) throws GridException; /** * Gets affinity block locations for data blocks of the file, i.e. the nodes, on which the blocks @@ -205,7 +205,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public Collection<GridGgfsBlockLocation> affinity(GridGgfsPath path, long start, long len) throws GridException; + public Collection<IgniteFsBlockLocation> affinity(IgniteFsPath path, long start, long len) throws GridException; /** * Get affinity block locations for data blocks of the file. In case {@code maxLen} parameter is set and @@ -220,7 +220,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public Collection<GridGgfsBlockLocation> affinity(GridGgfsPath path, long start, long len, long maxLen) + public Collection<IgniteFsBlockLocation> affinity(IgniteFsPath path, long start, long len, long maxLen) throws GridException; /** @@ -246,7 +246,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @return Total size. * @throws GridException In case of error. */ - public long size(GridGgfsPath path) throws GridException; + public long size(IgniteFsPath path) throws GridException; /** * Formats the file system removing all existing entries from it. @@ -270,7 +270,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException If execution failed. */ public <T, R> R execute(GridGgfsTask<T, R> task, @Nullable GridGgfsRecordResolver rslvr, - Collection<GridGgfsPath> paths, @Nullable T arg) throws GridException; + Collection<IgniteFsPath> paths, @Nullable T arg) throws GridException; /** * Executes GGFS task with overridden maximum range length (see @@ -290,7 +290,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException If execution failed. */ public <T, R> R execute(GridGgfsTask<T, R> task, @Nullable GridGgfsRecordResolver rslvr, - Collection<GridGgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) + Collection<IgniteFsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws GridException; /** @@ -306,7 +306,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException If execution failed. */ public <T, R> R execute(Class<? extends GridGgfsTask<T, R>> taskCls, - @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, @Nullable T arg) throws GridException; + @Nullable GridGgfsRecordResolver rslvr, Collection<IgniteFsPath> paths, @Nullable T arg) throws GridException; /** * Executes GGFS task with overridden maximum range length (see @@ -325,7 +325,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @throws GridException If execution failed. */ public <T, R> R execute(Class<? extends GridGgfsTask<T, R>> taskCls, - @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, boolean skipNonExistentFiles, + @Nullable GridGgfsRecordResolver rslvr, Collection<IgniteFsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws GridException; /** {@inheritDoc} */ http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/apache/ignite/events/IgniteFsEvent.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/events/IgniteFsEvent.java b/modules/core/src/main/java/org/apache/ignite/events/IgniteFsEvent.java index 41180fc..21e6a20 100644 --- a/modules/core/src/main/java/org/apache/ignite/events/IgniteFsEvent.java +++ b/modules/core/src/main/java/org/apache/ignite/events/IgniteFsEvent.java @@ -60,10 +60,10 @@ public class IgniteFsEvent extends IgniteEventAdapter { private static final long serialVersionUID = 0L; /** File path. */ - private final GridGgfsPath path; + private final IgniteFsPath path; /** New file path (for RENAME event). */ - private GridGgfsPath newPath; + private IgniteFsPath newPath; /** Data size (for data transfer events). */ private long dataSize; @@ -79,7 +79,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * @param node Node. * @param type Event type. */ - public IgniteFsEvent(GridGgfsPath path, ClusterNode node, int type) { + public IgniteFsEvent(IgniteFsPath path, ClusterNode node, int type) { super(node, "GGFS event.", type); this.path = path; @@ -95,7 +95,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * @param node Node. * @param type Event type. */ - public IgniteFsEvent(GridGgfsPath path, GridGgfsPath newPath, ClusterNode node, int type) { + public IgniteFsEvent(IgniteFsPath path, IgniteFsPath newPath, ClusterNode node, int type) { this(path, node, type); this.newPath = newPath; @@ -111,7 +111,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * @param type Event type. * @param dataSize Transferred data size in bytes. */ - public IgniteFsEvent(GridGgfsPath path, ClusterNode node, int type, long dataSize) { + public IgniteFsEvent(IgniteFsPath path, ClusterNode node, int type, long dataSize) { this(path, node, type); this.dataSize = dataSize; @@ -126,7 +126,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * @param type Event type. * @param meta Modified properties. */ - public IgniteFsEvent(GridGgfsPath path, ClusterNode node, int type, Map<String, String> meta) { + public IgniteFsEvent(IgniteFsPath path, ClusterNode node, int type, Map<String, String> meta) { this(path, node, type); this.meta = meta; @@ -137,7 +137,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * * @return File path. */ - public GridGgfsPath path() { + public IgniteFsPath path() { return path; } @@ -148,7 +148,7 @@ public class IgniteFsEvent extends IgniteEventAdapter { * @return New file or directory path or {@code null}, * if not relevant for this event. */ - @Nullable public GridGgfsPath newPath() { + @Nullable public IgniteFsPath newPath() { return newPath; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/cache/eviction/ggfs/GridCacheGgfsPerBlockLruEvictionPolicy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/cache/eviction/ggfs/GridCacheGgfsPerBlockLruEvictionPolicy.java b/modules/core/src/main/java/org/gridgain/grid/cache/eviction/ggfs/GridCacheGgfsPerBlockLruEvictionPolicy.java index 6d1822c..266b45c 100644 --- a/modules/core/src/main/java/org/gridgain/grid/cache/eviction/ggfs/GridCacheGgfsPerBlockLruEvictionPolicy.java +++ b/modules/core/src/main/java/org/gridgain/grid/cache/eviction/ggfs/GridCacheGgfsPerBlockLruEvictionPolicy.java @@ -263,7 +263,7 @@ public class GridCacheGgfsPerBlockLruEvictionPolicy implements GridCacheEviction * @return {@code True} in case non block of related file must be excluded. * @throws GridException In case of faulty patterns. */ - public boolean exclude(GridGgfsPath path) throws GridException { + public boolean exclude(IgniteFsPath path) throws GridException { assert path != null; Collection<Pattern> excludePatterns0; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsBlockLocation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsBlockLocation.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsBlockLocation.java deleted file mode 100644 index 743fdbf..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsBlockLocation.java +++ /dev/null @@ -1,55 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import java.util.*; - -/** - * {@code GGFS} file's data block location in the grid. It is used to determine - * node affinity of a certain file block within the Grid by calling - * {@link org.apache.ignite.IgniteFs#affinity(GridGgfsPath, long, long)} method. - */ -public interface GridGgfsBlockLocation { - /** - * Start position in the file this block relates to. - * - * @return Start position in the file this block relates to. - */ - public long start(); - - /** - * Length of the data block in the file. - * - * @return Length of the data block in the file. - */ - public long length(); - - /** - * Nodes this block belongs to. First node id in collection is - * primary node id. - * - * @return Nodes this block belongs to. - */ - public Collection<UUID> nodeIds(); - - /** - * Compliant with Hadoop interface. - * - * @return Collection of host:port addresses. - */ - public Collection<String> names(); - - /** - * Compliant with Hadoop interface. - * - * @return Collection of host names. - */ - public Collection<String> hosts(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsConcurrentModificationException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsConcurrentModificationException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsConcurrentModificationException.java index db0ad24..fa7c38d 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsConcurrentModificationException.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsConcurrentModificationException.java @@ -22,7 +22,7 @@ public class GridGgfsConcurrentModificationException extends GridGgfsException { * * @param path Affected path. */ - public GridGgfsConcurrentModificationException(GridGgfsPath path) { + public GridGgfsConcurrentModificationException(IgniteFsPath path) { super("File system entry has been modified concurrently: " + path, null); } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java index 180c4a8..558a961 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java @@ -29,7 +29,7 @@ public interface GridGgfsFile { * * @return Path to file. */ - public GridGgfsPath path(); + public IgniteFsPath path(); /** * Check this file is a data file. @@ -69,7 +69,7 @@ public interface GridGgfsFile { /** * Gets file last access time. File last access time is not updated automatically due to * performance considerations and can be updated on demand with - * {@link org.apache.ignite.IgniteFs#setTimes(GridGgfsPath, long, long)} method. + * {@link org.apache.ignite.IgniteFs#setTimes(IgniteFsPath, long, long)} method. * <p> * By default last access time equals file creation time. * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java index 6e59f16..2b57888 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java @@ -42,7 +42,7 @@ public interface GridGgfsFileSystem { * @return {@code True} if such file exists, otherwise - {@code false}. * @throws GridException In case of error. */ - public boolean exists(GridGgfsPath path) throws GridException; + public boolean exists(IgniteFsPath path) throws GridException; /** * Updates file information for the specified path. Existent properties, not listed in the passed collection, @@ -62,7 +62,7 @@ public interface GridGgfsFileSystem { * @return File information for specified path or {@code null} if such path does not exist. * @throws GridException In case of error. */ - @Nullable public GridGgfsFile update(GridGgfsPath path, Map<String, String> props) throws GridException; + @Nullable public GridGgfsFile update(IgniteFsPath path, Map<String, String> props) throws GridException; /** * Renames/moves a file. @@ -83,7 +83,7 @@ public interface GridGgfsFileSystem { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If source file doesn't exist. */ - public void rename(GridGgfsPath src, GridGgfsPath dest) throws GridException; + public void rename(IgniteFsPath src, IgniteFsPath dest) throws GridException; /** * Deletes file. @@ -93,7 +93,7 @@ public interface GridGgfsFileSystem { * @return {@code True} in case of success, {@code false} otherwise. * @throws GridException In case of error. */ - boolean delete(GridGgfsPath path, boolean recursive) throws GridException; + boolean delete(IgniteFsPath path, boolean recursive) throws GridException; /** * Creates directories under specified path. @@ -101,7 +101,7 @@ public interface GridGgfsFileSystem { * @param path Path of directories chain to create. * @throws GridException In case of error. */ - public void mkdirs(GridGgfsPath path) throws GridException; + public void mkdirs(IgniteFsPath path) throws GridException; /** * Creates directories under specified path with the specified properties. @@ -110,7 +110,7 @@ public interface GridGgfsFileSystem { * @param props Metadata properties to set on created directories. * @throws GridException In case of error. */ - public void mkdirs(GridGgfsPath path, @Nullable Map<String, String> props) throws GridException; + public void mkdirs(IgniteFsPath path, @Nullable Map<String, String> props) throws GridException; /** * Lists file paths under the specified path. @@ -120,7 +120,7 @@ public interface GridGgfsFileSystem { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public Collection<GridGgfsPath> listPaths(GridGgfsPath path) throws GridException; + public Collection<IgniteFsPath> listPaths(IgniteFsPath path) throws GridException; /** * Lists files under the specified path. @@ -130,7 +130,7 @@ public interface GridGgfsFileSystem { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public Collection<GridGgfsFile> listFiles(GridGgfsPath path) throws GridException; + public Collection<GridGgfsFile> listFiles(IgniteFsPath path) throws GridException; /** * Opens a file for reading. @@ -141,7 +141,7 @@ public interface GridGgfsFileSystem { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist. */ - public GridGgfsReader open(GridGgfsPath path, int bufSize) throws GridException; + public IgniteFsReader open(IgniteFsPath path, int bufSize) throws GridException; /** * Creates a file and opens it for writing. @@ -151,7 +151,7 @@ public interface GridGgfsFileSystem { * @return File output stream to write data to. * @throws GridException In case of error. */ - public OutputStream create(GridGgfsPath path, boolean overwrite) throws GridException; + public OutputStream create(IgniteFsPath path, boolean overwrite) throws GridException; /** * Creates a file and opens it for writing. @@ -165,7 +165,7 @@ public interface GridGgfsFileSystem { * @return File output stream to write data to. * @throws GridException In case of error. */ - public OutputStream create(GridGgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize, + public OutputStream create(IgniteFsPath path, int bufSize, boolean overwrite, int replication, long blockSize, @Nullable Map<String, String> props) throws GridException; /** @@ -179,7 +179,7 @@ public interface GridGgfsFileSystem { * @throws GridException In case of error. * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. */ - public OutputStream append(GridGgfsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) + public OutputStream append(IgniteFsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) throws GridException; /** @@ -189,7 +189,7 @@ public interface GridGgfsFileSystem { * @return File information for specified path or {@code null} if such path does not exist. * @throws GridException In case of error. */ - @Nullable public GridGgfsFile info(GridGgfsPath path) throws GridException; + @Nullable public GridGgfsFile info(IgniteFsPath path) throws GridException; /** * Gets used space in bytes. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsInputStream.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsInputStream.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsInputStream.java index e178f45..e3f8c0b 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsInputStream.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsInputStream.java @@ -15,7 +15,7 @@ import java.io.*; * {@code GGFS} input stream to read data from the file system. * It provides several additional methods for asynchronous access. */ -public abstract class GridGgfsInputStream extends InputStream implements GridGgfsReader { +public abstract class GridGgfsInputStream extends InputStream implements IgniteFsReader { /** * Gets file length during file open. * http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPath.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPath.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPath.java deleted file mode 100644 index 6beed3d..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPath.java +++ /dev/null @@ -1,254 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.gridgain.grid.util.io.*; -import org.gridgain.grid.util.typedef.*; -import org.gridgain.grid.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.net.*; -import java.util.*; - -/** - * {@code GGFS} path to file in the file system. For example, to get information about - * a file you would use the following code: - * <pre name="code" class="java"> - * GridGgfsPath dirPath = new GridGgfsPath("/my/working/dir"); - * GridGgfsPath filePath = new GridGgfsPath(dirPath, "file.txt"); - * - * // Get metadata about file. - * GridGgfsFile file = ggfs.info(filePath); - * </pre> - */ -public final class GridGgfsPath implements Comparable<GridGgfsPath>, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** The directory separator character. */ - private static final char SLASH_CHAR = '/'; - - /** The directory separator. */ - private static final String SLASH = "/"; - - /** URI representing this path. Should never change after object creation or de-serialization. */ - private String path; - - /** - * Constructs default root path. - */ - public GridGgfsPath() { - path = SLASH; - } - - /** - * Constructs a path from an URI - * - * @param uri URI to create path from. - */ - public GridGgfsPath(URI uri) { - A.notNull(uri, "uri"); - - path = normalizePath(uri.getPath()); - } - - /** - * Constructs a path from the URI string. - * - * @param path URI string. - */ - public GridGgfsPath(String path) { - A.ensure(!F.isEmpty(path), "'path' is null or empty"); - - this.path = normalizePath(path); - } - - /** - * Resolve a child path against a parent path. - * - * @param parentPath Parent path. - * @param childPath Child path. - */ - public GridGgfsPath(GridGgfsPath parentPath, String childPath) { - A.notNull(parentPath, "parentPath"); - - String path = GridFilenameUtils.concat(parentPath.path, childPath); - - if (F.isEmpty(path)) - throw new IllegalArgumentException("Failed to parse path" + - " [parent=" + parentPath + ", childPath=" + childPath + ']'); - - this.path = normalizePath(path); - } - - /** - * Initialize path with (1) not-null, (2) normalized, (3) absolute and (4) unix-format path component. - * - * @param path Path. - * @return Normalized path. - */ - private static String normalizePath(String path) { - assert path != null; - - String normalizedPath = GridFilenameUtils.normalizeNoEndSeparator(path, true); - - if (F.isEmpty(normalizedPath)) - throw new IllegalArgumentException("Failed to normalize path: " + path); - - if (!SLASH.equals(GridFilenameUtils.getPrefix(normalizedPath))) - throw new IllegalArgumentException("Path should be absolute: " + path); - - assert !normalizedPath.isEmpty() : "Expects normalized path is not empty."; - assert normalizedPath.length() == 1 || !normalizedPath.endsWith(SLASH) : - "Expects normalized path is root or don't ends with '/' symbol."; - - return normalizedPath; - } - - /** - * Returns the final component of this path. - * - * @return The final component of this path. - */ - public String name() { - return GridFilenameUtils.getName(path); - } - - /** - * Returns a root for this path. - * - * @return Root for this path. - */ - public GridGgfsPath root() { - return new GridGgfsPath(); - } - - /** - * Split full path on components. - * - * @return Path components. - */ - public List<String> components() { - String path = this.path; - - assert path.length() >= 1 : "Path expected to be absolute: " + path; - - // Path is short-living object, so we don't need to cache component's resolution result. - return path.length() == 1 ? Collections.<String>emptyList() : Arrays.asList(path.substring(1).split(SLASH)); - } - - /** - * Returns the parent of a path or {@code null} if at root. - * - * @return The parent of a path or {@code null} if at root. - */ - @Nullable public GridGgfsPath parent() { - String path = this.path; - - if (path.length() == 1) - return null; // Current path is root. - - path = GridFilenameUtils.getFullPathNoEndSeparator(path); - - return new GridGgfsPath(path); - } - - /** - * Adds a suffix to the final name in the path. - * - * @param suffix Suffix. - * @return Path with suffix. - */ - public GridGgfsPath suffix(String suffix) { - A.ensure(!F.isEmpty(suffix), "'suffix' is null or empty."); - A.ensure(!suffix.contains(SLASH), "'suffix' contains file's separator '" + SLASH + "'"); - - return new GridGgfsPath(path + suffix); - } - - /** - * Return the number of elements in this path. - * - * @return The number of elements in this path, zero depth means root directory. - */ - public int depth() { - final String path = this.path; - final int size = path.length(); - - assert size >= 1 && path.charAt(0) == SLASH_CHAR : "Expects absolute path: " + path; - - if (size == 1) - return 0; - - int depth = 1; - - // Ignore the first character. - for (int i = 1; i < size; i++) - if (path.charAt(i) == SLASH_CHAR) - depth++; - - return depth; - } - - /** - * Checks whether this path is a sub-directory of argument. - * - * @param path Path to check. - * @return {@code True} if argument is same or a sub-directory of this object. - */ - public boolean isSubDirectoryOf(GridGgfsPath path) { - A.notNull(path, "path"); - - return this.path.startsWith(path.path.endsWith(SLASH) ? path.path : path.path + SLASH); - } - - /** - * Checks if paths are identical. - * - * @param path Path to check. - * @return {@code True} if paths are identical. - */ - public boolean isSame(GridGgfsPath path) { - A.notNull(path, "path"); - - return this == path || this.path.equals(path.path); - } - - /** {@inheritDoc} */ - @Override public int compareTo(GridGgfsPath o) { - return path.compareTo(o.path); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - U.writeString(out, path); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException { - path = U.readString(in); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return path.hashCode(); - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - return o == this || o != null && getClass() == o.getClass() && path.equals(((GridGgfsPath)o).path); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return path; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathAlreadyExistsException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathAlreadyExistsException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathAlreadyExistsException.java deleted file mode 100644 index fdeedb3..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathAlreadyExistsException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.jetbrains.annotations.*; - -/** - * Exception thrown when target path supposed to be created already exists. - */ -public class GridGgfsPathAlreadyExistsException extends GridGgfsInvalidPathException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param msg Error message. - */ - public GridGgfsPathAlreadyExistsException(String msg) { - super(msg); - } - - /** - * @param cause Exception cause. - */ - public GridGgfsPathAlreadyExistsException(Throwable cause) { - super(cause); - } - - /** - * @param msg Error message. - * @param cause Exception cause. - */ - public GridGgfsPathAlreadyExistsException(String msg, @Nullable Throwable cause) { - super(msg, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathSummary.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathSummary.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathSummary.java deleted file mode 100644 index 1ad9bfe..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsPathSummary.java +++ /dev/null @@ -1,130 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.gridgain.grid.util.typedef.internal.*; - -import java.io.*; - -/** - * Path summary: total files count, total directories count, total length. - */ -public class GridGgfsPathSummary implements Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Path. */ - private GridGgfsPath path; - - /** File count. */ - private int filesCnt; - - /** Directories count. */ - private int dirCnt; - - /** Length consumed. */ - private long totalLen; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public GridGgfsPathSummary() { - // No-op. - } - - /** - * Construct empty path summary. - * - * @param path Path. - */ - public GridGgfsPathSummary(GridGgfsPath path) { - this.path = path; - } - - /** - * @return Files count. - */ - public int filesCount() { - return filesCnt; - } - - /** - * @param filesCnt Files count. - */ - public void filesCount(int filesCnt) { - this.filesCnt = filesCnt; - } - - /** - * @return Directories count. - */ - public int directoriesCount() { - return dirCnt; - } - - /** - * @param dirCnt Directories count. - */ - public void directoriesCount(int dirCnt) { - this.dirCnt = dirCnt; - } - - /** - * @return Total length. - */ - public long totalLength() { - return totalLen; - } - - /** - * @param totalLen Total length. - */ - public void totalLength(long totalLen) { - this.totalLen = totalLen; - } - - /** - * @return Path for which summary is obtained. - */ - public GridGgfsPath path() { - return path; - } - - /** - * @param path Path for which summary is obtained. - */ - public void path(GridGgfsPath path) { - this.path = path; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(filesCnt); - out.writeInt(dirCnt); - out.writeLong(totalLen); - - path.writeExternal(out); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - filesCnt = in.readInt(); - dirCnt = in.readInt(); - totalLen = in.readLong(); - - path = new GridGgfsPath(); - path.readExternal(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridGgfsPathSummary.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsReader.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsReader.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsReader.java deleted file mode 100644 index 0e1883b..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsReader.java +++ /dev/null @@ -1,30 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import java.io.*; - -/** - * The simplest data input interface to read from secondary file system in dual modes. - */ -public interface GridGgfsReader extends Closeable { - /** - * Read up to the specified number of bytes, from a given position within a file, and return the number of bytes - * read. - * - * @param pos Position in the input stream to seek. - * @param buf Buffer into which data is read. - * @param off Offset in the buffer from which stream data should be written. - * @param len The number of bytes to read. - * @return Total number of bytes read into the buffer, or -1 if there is no more data (EOF). - * @throws IOException In case of any exception. - */ - public int read(long pos, byte[] buf, int off, int len) throws IOException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsBlockLocation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsBlockLocation.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsBlockLocation.java new file mode 100644 index 0000000..403ee3c --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsBlockLocation.java @@ -0,0 +1,55 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import java.util.*; + +/** + * {@code GGFS} file's data block location in the grid. It is used to determine + * node affinity of a certain file block within the Grid by calling + * {@link org.apache.ignite.IgniteFs#affinity(IgniteFsPath, long, long)} method. + */ +public interface IgniteFsBlockLocation { + /** + * Start position in the file this block relates to. + * + * @return Start position in the file this block relates to. + */ + public long start(); + + /** + * Length of the data block in the file. + * + * @return Length of the data block in the file. + */ + public long length(); + + /** + * Nodes this block belongs to. First node id in collection is + * primary node id. + * + * @return Nodes this block belongs to. + */ + public Collection<UUID> nodeIds(); + + /** + * Compliant with Hadoop interface. + * + * @return Collection of host:port addresses. + */ + public Collection<String> names(); + + /** + * Compliant with Hadoop interface. + * + * @return Collection of host names. + */ + public Collection<String> hosts(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPath.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPath.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPath.java new file mode 100644 index 0000000..aa321b3 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPath.java @@ -0,0 +1,254 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.gridgain.grid.util.io.*; +import org.gridgain.grid.util.typedef.*; +import org.gridgain.grid.util.typedef.internal.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.net.*; +import java.util.*; + +/** + * {@code GGFS} path to file in the file system. For example, to get information about + * a file you would use the following code: + * <pre name="code" class="java"> + * GridGgfsPath dirPath = new GridGgfsPath("/my/working/dir"); + * GridGgfsPath filePath = new GridGgfsPath(dirPath, "file.txt"); + * + * // Get metadata about file. + * GridGgfsFile file = ggfs.info(filePath); + * </pre> + */ +public final class IgniteFsPath implements Comparable<IgniteFsPath>, Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** The directory separator character. */ + private static final char SLASH_CHAR = '/'; + + /** The directory separator. */ + private static final String SLASH = "/"; + + /** URI representing this path. Should never change after object creation or de-serialization. */ + private String path; + + /** + * Constructs default root path. + */ + public IgniteFsPath() { + path = SLASH; + } + + /** + * Constructs a path from an URI + * + * @param uri URI to create path from. + */ + public IgniteFsPath(URI uri) { + A.notNull(uri, "uri"); + + path = normalizePath(uri.getPath()); + } + + /** + * Constructs a path from the URI string. + * + * @param path URI string. + */ + public IgniteFsPath(String path) { + A.ensure(!F.isEmpty(path), "'path' is null or empty"); + + this.path = normalizePath(path); + } + + /** + * Resolve a child path against a parent path. + * + * @param parentPath Parent path. + * @param childPath Child path. + */ + public IgniteFsPath(IgniteFsPath parentPath, String childPath) { + A.notNull(parentPath, "parentPath"); + + String path = GridFilenameUtils.concat(parentPath.path, childPath); + + if (F.isEmpty(path)) + throw new IllegalArgumentException("Failed to parse path" + + " [parent=" + parentPath + ", childPath=" + childPath + ']'); + + this.path = normalizePath(path); + } + + /** + * Initialize path with (1) not-null, (2) normalized, (3) absolute and (4) unix-format path component. + * + * @param path Path. + * @return Normalized path. + */ + private static String normalizePath(String path) { + assert path != null; + + String normalizedPath = GridFilenameUtils.normalizeNoEndSeparator(path, true); + + if (F.isEmpty(normalizedPath)) + throw new IllegalArgumentException("Failed to normalize path: " + path); + + if (!SLASH.equals(GridFilenameUtils.getPrefix(normalizedPath))) + throw new IllegalArgumentException("Path should be absolute: " + path); + + assert !normalizedPath.isEmpty() : "Expects normalized path is not empty."; + assert normalizedPath.length() == 1 || !normalizedPath.endsWith(SLASH) : + "Expects normalized path is root or don't ends with '/' symbol."; + + return normalizedPath; + } + + /** + * Returns the final component of this path. + * + * @return The final component of this path. + */ + public String name() { + return GridFilenameUtils.getName(path); + } + + /** + * Returns a root for this path. + * + * @return Root for this path. + */ + public IgniteFsPath root() { + return new IgniteFsPath(); + } + + /** + * Split full path on components. + * + * @return Path components. + */ + public List<String> components() { + String path = this.path; + + assert path.length() >= 1 : "Path expected to be absolute: " + path; + + // Path is short-living object, so we don't need to cache component's resolution result. + return path.length() == 1 ? Collections.<String>emptyList() : Arrays.asList(path.substring(1).split(SLASH)); + } + + /** + * Returns the parent of a path or {@code null} if at root. + * + * @return The parent of a path or {@code null} if at root. + */ + @Nullable public IgniteFsPath parent() { + String path = this.path; + + if (path.length() == 1) + return null; // Current path is root. + + path = GridFilenameUtils.getFullPathNoEndSeparator(path); + + return new IgniteFsPath(path); + } + + /** + * Adds a suffix to the final name in the path. + * + * @param suffix Suffix. + * @return Path with suffix. + */ + public IgniteFsPath suffix(String suffix) { + A.ensure(!F.isEmpty(suffix), "'suffix' is null or empty."); + A.ensure(!suffix.contains(SLASH), "'suffix' contains file's separator '" + SLASH + "'"); + + return new IgniteFsPath(path + suffix); + } + + /** + * Return the number of elements in this path. + * + * @return The number of elements in this path, zero depth means root directory. + */ + public int depth() { + final String path = this.path; + final int size = path.length(); + + assert size >= 1 && path.charAt(0) == SLASH_CHAR : "Expects absolute path: " + path; + + if (size == 1) + return 0; + + int depth = 1; + + // Ignore the first character. + for (int i = 1; i < size; i++) + if (path.charAt(i) == SLASH_CHAR) + depth++; + + return depth; + } + + /** + * Checks whether this path is a sub-directory of argument. + * + * @param path Path to check. + * @return {@code True} if argument is same or a sub-directory of this object. + */ + public boolean isSubDirectoryOf(IgniteFsPath path) { + A.notNull(path, "path"); + + return this.path.startsWith(path.path.endsWith(SLASH) ? path.path : path.path + SLASH); + } + + /** + * Checks if paths are identical. + * + * @param path Path to check. + * @return {@code True} if paths are identical. + */ + public boolean isSame(IgniteFsPath path) { + A.notNull(path, "path"); + + return this == path || this.path.equals(path.path); + } + + /** {@inheritDoc} */ + @Override public int compareTo(IgniteFsPath o) { + return path.compareTo(o.path); + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + U.writeString(out, path); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException { + path = U.readString(in); + } + + /** {@inheritDoc} */ + @Override public int hashCode() { + return path.hashCode(); + } + + /** {@inheritDoc} */ + @Override public boolean equals(Object o) { + return o == this || o != null && getClass() == o.getClass() && path.equals(((IgniteFsPath)o).path); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return path; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathAlreadyExistsException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathAlreadyExistsException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathAlreadyExistsException.java new file mode 100644 index 0000000..7ca2581 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathAlreadyExistsException.java @@ -0,0 +1,42 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.jetbrains.annotations.*; + +/** + * Exception thrown when target path supposed to be created already exists. + */ +public class IgniteFsPathAlreadyExistsException extends GridGgfsInvalidPathException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * @param msg Error message. + */ + public IgniteFsPathAlreadyExistsException(String msg) { + super(msg); + } + + /** + * @param cause Exception cause. + */ + public IgniteFsPathAlreadyExistsException(Throwable cause) { + super(cause); + } + + /** + * @param msg Error message. + * @param cause Exception cause. + */ + public IgniteFsPathAlreadyExistsException(String msg, @Nullable Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathSummary.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathSummary.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathSummary.java new file mode 100644 index 0000000..706a3cb --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsPathSummary.java @@ -0,0 +1,130 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.gridgain.grid.util.typedef.internal.*; + +import java.io.*; + +/** + * Path summary: total files count, total directories count, total length. + */ +public class IgniteFsPathSummary implements Externalizable { + /** */ + private static final long serialVersionUID = 0L; + + /** Path. */ + private IgniteFsPath path; + + /** File count. */ + private int filesCnt; + + /** Directories count. */ + private int dirCnt; + + /** Length consumed. */ + private long totalLen; + + /** + * Empty constructor required by {@link Externalizable}. + */ + public IgniteFsPathSummary() { + // No-op. + } + + /** + * Construct empty path summary. + * + * @param path Path. + */ + public IgniteFsPathSummary(IgniteFsPath path) { + this.path = path; + } + + /** + * @return Files count. + */ + public int filesCount() { + return filesCnt; + } + + /** + * @param filesCnt Files count. + */ + public void filesCount(int filesCnt) { + this.filesCnt = filesCnt; + } + + /** + * @return Directories count. + */ + public int directoriesCount() { + return dirCnt; + } + + /** + * @param dirCnt Directories count. + */ + public void directoriesCount(int dirCnt) { + this.dirCnt = dirCnt; + } + + /** + * @return Total length. + */ + public long totalLength() { + return totalLen; + } + + /** + * @param totalLen Total length. + */ + public void totalLength(long totalLen) { + this.totalLen = totalLen; + } + + /** + * @return Path for which summary is obtained. + */ + public IgniteFsPath path() { + return path; + } + + /** + * @param path Path for which summary is obtained. + */ + public void path(IgniteFsPath path) { + this.path = path; + } + + /** {@inheritDoc} */ + @Override public void writeExternal(ObjectOutput out) throws IOException { + out.writeInt(filesCnt); + out.writeInt(dirCnt); + out.writeLong(totalLen); + + path.writeExternal(out); + } + + /** {@inheritDoc} */ + @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { + filesCnt = in.readInt(); + dirCnt = in.readInt(); + totalLen = in.readLong(); + + path = new IgniteFsPath(); + path.readExternal(in); + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IgniteFsPathSummary.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsReader.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsReader.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsReader.java new file mode 100644 index 0000000..dd0635c --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsReader.java @@ -0,0 +1,30 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import java.io.*; + +/** + * The simplest data input interface to read from secondary file system in dual modes. + */ +public interface IgniteFsReader extends Closeable { + /** + * Read up to the specified number of bytes, from a given position within a file, and return the number of bytes + * read. + * + * @param pos Position in the input stream to seek. + * @param buf Buffer into which data is read. + * @param off Offset in the buffer from which stream data should be written. + * @param len The number of bytes to read. + * @return Total number of bytes read into the buffer, or -1 if there is no more data (EOF). + * @throws IOException In case of any exception. + */ + public int read(long pos, byte[] buf, int off, int len) throws IOException; +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsFileRange.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsFileRange.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsFileRange.java index e2e8066..e37def7 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsFileRange.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsFileRange.java @@ -17,7 +17,7 @@ import org.gridgain.grid.util.typedef.internal.*; */ public class GridGgfsFileRange { /** File path. */ - private GridGgfsPath path; + private IgniteFsPath path; /** Start position. */ private long start; @@ -32,7 +32,7 @@ public class GridGgfsFileRange { * @param start Start position. * @param len Length. */ - public GridGgfsFileRange(GridGgfsPath path, long start, long len) { + public GridGgfsFileRange(IgniteFsPath path, long start, long len) { this.path = path; this.start = start; this.len = len; @@ -43,7 +43,7 @@ public class GridGgfsFileRange { * * @return File path. */ - public GridGgfsPath path() { + public IgniteFsPath path() { return path; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java index f65be08..e8ac409 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java @@ -26,7 +26,7 @@ import java.util.*; * GGFS task which can be executed on the grid using one of {@code GridGgfs.execute()} methods. Essentially GGFS task * is regular {@link org.apache.ignite.compute.ComputeTask} with different map logic. Instead of implementing * {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method to split task into jobs, you must implement - * {@link GridGgfsTask#createJob(GridGgfsPath, GridGgfsFileRange, GridGgfsTaskArgs)} method. + * {@link GridGgfsTask#createJob(org.gridgain.grid.ggfs.IgniteFsPath, GridGgfsFileRange, GridGgfsTaskArgs)} method. * <p> * Each file participating in GGFS task is split into {@link GridGgfsFileRange}s first. Normally range is a number of * consequent bytes located on a single node (see {@code GridGgfsGroupDataBlocksKeyMapper}). In case maximum range size @@ -88,7 +88,7 @@ public abstract class GridGgfsTask<T, R> extends ComputeTaskAdapter<GridGgfsTask Map<UUID, ClusterNode> nodes = mapSubgrid(subgrid); - for (GridGgfsPath path : args.paths()) { + for (IgniteFsPath path : args.paths()) { GridGgfsFile file = ggfs.info(path); if (file == null) { @@ -98,11 +98,11 @@ public abstract class GridGgfsTask<T, R> extends ComputeTaskAdapter<GridGgfsTask throw new GridException("Failed to process GGFS file because it doesn't exist: " + path); } - Collection<GridGgfsBlockLocation> aff = ggfs.affinity(path, 0, file.length(), args.maxRangeLength()); + Collection<IgniteFsBlockLocation> aff = ggfs.affinity(path, 0, file.length(), args.maxRangeLength()); long totalLen = 0; - for (GridGgfsBlockLocation loc : aff) { + for (IgniteFsBlockLocation loc : aff) { ClusterNode node = null; for (UUID nodeId : loc.nodeIds()) { @@ -145,7 +145,7 @@ public abstract class GridGgfsTask<T, R> extends ComputeTaskAdapter<GridGgfsTask * @return GGFS job. If {@code null} is returned, the passed in file range will be skipped. * @throws GridException If job creation failed. */ - @Nullable public abstract GridGgfsJob createJob(GridGgfsPath path, GridGgfsFileRange range, + @Nullable public abstract GridGgfsJob createJob(IgniteFsPath path, GridGgfsFileRange range, GridGgfsTaskArgs<T> args) throws GridException; /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTaskArgs.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTaskArgs.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTaskArgs.java index c9cb5c8..469e703 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTaskArgs.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTaskArgs.java @@ -16,7 +16,7 @@ import java.util.*; /** * GGFS task arguments. When you initiate new GGFS task execution using one of {@code GridGgfs.execute(...)} methods, * all passed parameters are encapsulated in a single {@code GridGgfsTaskArgs} object. Later on this object is - * passed to {@link GridGgfsTask#createJob(GridGgfsPath, GridGgfsFileRange, GridGgfsTaskArgs)} method. + * passed to {@link GridGgfsTask#createJob(org.gridgain.grid.ggfs.IgniteFsPath, GridGgfsFileRange, GridGgfsTaskArgs)} method. * <p> * Task arguments encapsulates the following data: * <ul> @@ -41,7 +41,7 @@ public interface GridGgfsTaskArgs<T> { * * @return File paths to process. */ - public Collection<GridGgfsPath> paths(); + public Collection<IgniteFsPath> paths(); /** * Gets record resolver for the task. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java index 1ed5a70..216e888 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java @@ -169,7 +169,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Response. */ - public void response(GridGgfsPath res) { + public void response(IgniteFsPath res) { resType = RES_TYPE_GGFS_PATH; this.res = res; @@ -178,7 +178,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Path summary response. */ - public void response(GridGgfsPathSummary res) { + public void response(IgniteFsPathSummary res) { resType = RES_TYPE_GGFS_PATH_SUMMARY; this.res = res; @@ -196,7 +196,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Response. */ - public void paths(Collection<GridGgfsPath> res) { + public void paths(Collection<IgniteFsPath> res) { resType = RES_TYPE_COL_GGFS_PATH; this.res = res; @@ -205,7 +205,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Response. */ - public void locations(Collection<GridGgfsBlockLocation> res) { + public void locations(Collection<IgniteFsBlockLocation> res) { resType = RES_TYPE_COL_GGFS_BLOCK_LOCATION; this.res = res; @@ -255,7 +255,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { if (errCode == ERR_FILE_NOT_FOUND) throw new GridGgfsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) - throw new GridGgfsPathAlreadyExistsException(err); + throw new IgniteFsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) throw new GridGgfsDirectoryNotEmptyException(err); else if (errCode == ERR_PARENT_NOT_DIRECTORY) @@ -326,7 +326,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { private int errorCode(GridException e, boolean checkIo) { if (X.hasCause(e, GridGgfsFileNotFoundException.class)) return ERR_FILE_NOT_FOUND; - else if (GridGgfsPathAlreadyExistsException.class.isInstance(e)) + else if (IgniteFsPathAlreadyExistsException.class.isInstance(e)) return ERR_PATH_ALREADY_EXISTS; else if (GridGgfsDirectoryNotEmptyException.class.isInstance(e)) return ERR_DIRECTORY_NOT_EMPTY; @@ -467,7 +467,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { boolean hasVal = in.readBoolean(); if (hasVal) { - GridGgfsPath path = new GridGgfsPath(); + IgniteFsPath path = new IgniteFsPath(); path.readExternal(in); @@ -481,7 +481,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { boolean hasVal = in.readBoolean(); if (hasVal) { - GridGgfsPathSummary sum = new GridGgfsPathSummary(); + IgniteFsPathSummary sum = new IgniteFsPathSummary(); sum.readExternal(in); @@ -570,7 +570,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { } case RES_TYPE_COL_GGFS_PATH: { - Collection<GridGgfsPath> paths = null; + Collection<IgniteFsPath> paths = null; int size = in.readInt(); @@ -578,7 +578,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { paths = new ArrayList<>(size); for (int i = 0; i < size; i++) { - GridGgfsPath path = new GridGgfsPath(); + IgniteFsPath path = new IgniteFsPath(); path.readExternal(in); @@ -592,7 +592,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { } case RES_TYPE_COL_GGFS_BLOCK_LOCATION: { - Collection<GridGgfsBlockLocation> locations = null; + Collection<IgniteFsBlockLocation> locations = null; int size = in.readInt(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsLogger.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsLogger.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsLogger.java index 36741d2..b1b7d8f 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsLogger.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsLogger.java @@ -248,7 +248,7 @@ public final class GridGgfsLogger { * @param bufSize Buffer size. * @param dataLen Data length. */ - public void logOpen(long streamId, GridGgfsPath path, GridGgfsMode mode, int bufSize, long dataLen) { + public void logOpen(long streamId, IgniteFsPath path, GridGgfsMode mode, int bufSize, long dataLen) { addEntry(new Entry(TYPE_OPEN_IN, path.toString(), mode, streamId, bufSize, dataLen, null, null, null, null, null, null, null, null, null, null, null, null, null, null)); } @@ -264,7 +264,7 @@ public final class GridGgfsLogger { * @param replication Replication factor. * @param blockSize Block size. */ - public void logCreate(long streamId, GridGgfsPath path, GridGgfsMode mode, boolean overwrite, int bufSize, + public void logCreate(long streamId, IgniteFsPath path, GridGgfsMode mode, boolean overwrite, int bufSize, int replication, long blockSize) { addEntry(new Entry(TYPE_OPEN_OUT, path.toString(), mode, streamId, bufSize, null, false, overwrite, replication, blockSize, null, null, null, null, null, null, null, null, null, null)); @@ -278,7 +278,7 @@ public final class GridGgfsLogger { * @param mode Mode. * @param bufSize Buffer size. */ - public void logAppend(long streamId, GridGgfsPath path, GridGgfsMode mode, int bufSize) { + public void logAppend(long streamId, IgniteFsPath path, GridGgfsMode mode, int bufSize) { addEntry(new Entry(TYPE_OPEN_OUT, path.toString(), mode, streamId, bufSize, null, true, null, null, null, null, null, null, null, null, null, null, null, null, null)); } @@ -370,7 +370,7 @@ public final class GridGgfsLogger { * @param path Path. * @param mode Mode. */ - public void logMakeDirectory(GridGgfsPath path, GridGgfsMode mode) { + public void logMakeDirectory(IgniteFsPath path, GridGgfsMode mode) { addEntry(new Entry(TYPE_DIR_MAKE, path.toString(), mode, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null)); } @@ -382,7 +382,7 @@ public final class GridGgfsLogger { * @param mode Mode. * @param files Files. */ - public void logListDirectory(GridGgfsPath path, GridGgfsMode mode, String[] files) { + public void logListDirectory(IgniteFsPath path, GridGgfsMode mode, String[] files) { addEntry(new Entry(TYPE_DIR_LIST, path.toString(), mode, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, files)); } @@ -394,7 +394,7 @@ public final class GridGgfsLogger { * @param mode Mode. * @param destPath Destination path. */ - public void logRename(GridGgfsPath path, GridGgfsMode mode, GridGgfsPath destPath) { + public void logRename(IgniteFsPath path, GridGgfsMode mode, IgniteFsPath destPath) { addEntry(new Entry(TYPE_RENAME, path.toString(), mode, null, null, null, null, null, null, null, null, null, null, null, null, null, null, destPath.toString(), null, null)); } @@ -406,7 +406,7 @@ public final class GridGgfsLogger { * @param mode Mode. * @param recursive Recursive flag. */ - public void logDelete(GridGgfsPath path, GridGgfsMode mode, boolean recursive) { + public void logDelete(IgniteFsPath path, GridGgfsMode mode, boolean recursive) { addEntry(new Entry(TYPE_DELETE, path.toString(), mode, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, recursive, null)); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsMarshaller.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsMarshaller.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsMarshaller.java index 22d8fa5..24a8807 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsMarshaller.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsMarshaller.java @@ -308,7 +308,7 @@ public class GridGgfsMarshaller { * @param path Path to write. * @throws IOException If write failed. */ - private void writePath(ObjectOutput out, @Nullable GridGgfsPath path) throws IOException { + private void writePath(ObjectOutput out, @Nullable IgniteFsPath path) throws IOException { out.writeBoolean(path != null); if (path != null) @@ -316,15 +316,15 @@ public class GridGgfsMarshaller { } /** - * Reads GGFS path from data input that was written by {@link #writePath(ObjectOutput, GridGgfsPath)} + * Reads GGFS path from data input that was written by {@link #writePath(ObjectOutput, org.gridgain.grid.ggfs.IgniteFsPath)} * method. * * @param in Data input. * @return Written path or {@code null}. */ - @Nullable private GridGgfsPath readPath(ObjectInput in) throws IOException { + @Nullable private IgniteFsPath readPath(ObjectInput in) throws IOException { if(in.readBoolean()) { - GridGgfsPath path = new GridGgfsPath(); + IgniteFsPath path = new IgniteFsPath(); path.readExternal(in); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f3d93762/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsPathControlRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsPathControlRequest.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsPathControlRequest.java index 4da7ba6..00b7718 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsPathControlRequest.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsPathControlRequest.java @@ -20,10 +20,10 @@ import java.util.*; */ public class GridGgfsPathControlRequest extends GridGgfsMessage { /** Main path. */ - private GridGgfsPath path; + private IgniteFsPath path; /** Second path, rename command. */ - private GridGgfsPath destPath; + private IgniteFsPath destPath; /** Boolean flag, meaning depends on command. */ private boolean flag; @@ -58,14 +58,14 @@ public class GridGgfsPathControlRequest extends GridGgfsMessage { /** * @param path Path. */ - public void path(GridGgfsPath path) { + public void path(IgniteFsPath path) { this.path = path; } /** * @param destPath Destination path (rename only). */ - public void destinationPath(GridGgfsPath destPath) { + public void destinationPath(IgniteFsPath destPath) { this.destPath = destPath; } @@ -142,14 +142,14 @@ public class GridGgfsPathControlRequest extends GridGgfsMessage { /** * @return Path. */ - public GridGgfsPath path() { + public IgniteFsPath path() { return path; } /** * @return Destination path (rename only). */ - public GridGgfsPath destinationPath() { + public IgniteFsPath destinationPath() { return destPath; }