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 2016/06/05 15:22:03 UTC
ignite git commit: Added "listFiles", "listPaths".
Repository: ignite
Updated Branches:
refs/heads/ignite-3247 209d7d5b2 -> e50634935
Added "listFiles", "listPaths".
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e5063493
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e5063493
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e5063493
Branch: refs/heads/ignite-3247
Commit: e50634935f90b27c8c7a6fa92adebd21c3b0daaa
Parents: 209d7d5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Sun Jun 5 18:21:58 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Sun Jun 5 18:21:58 2016 +0300
----------------------------------------------------------------------
.../internal/processors/igfs/IgfsImpl.java | 8 +++
.../igfs/client/IgfsClientDeleteCallable.java | 2 +-
.../igfs/client/IgfsClientExistsCallable.java | 2 +-
.../igfs/client/IgfsClientInfoCallable.java | 2 +-
.../client/IgfsClientListFilesCallable.java | 61 ++++++++++++++++++++
.../client/IgfsClientListPathsCallable.java | 60 +++++++++++++++++++
6 files changed, 132 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/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 dfedd7d..2a7f1e8 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
@@ -58,6 +58,8 @@ import org.apache.ignite.internal.processors.hadoop.HadoopPayloadAware;
import org.apache.ignite.internal.processors.igfs.client.IgfsClientDeleteCallable;
import org.apache.ignite.internal.processors.igfs.client.IgfsClientExistsCallable;
import org.apache.ignite.internal.processors.igfs.client.IgfsClientInfoCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientListFilesCallable;
+import org.apache.ignite.internal.processors.igfs.client.IgfsClientListPathsCallable;
import org.apache.ignite.internal.processors.igfs.client.IgfsClientMkdirsCallable;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.GridSpinBusyLock;
@@ -809,6 +811,9 @@ public final class IgfsImpl implements IgfsEx {
@Override public Collection<IgfsPath> listPaths(final IgfsPath path) {
A.notNull(path, "path");
+ if (meta.isClient())
+ meta.runClientTask(new IgfsClientListPathsCallable(cfg.getName(), path));
+
return safeOp(new Callable<Collection<IgfsPath>>() {
@Override public Collection<IgfsPath> call() throws Exception {
if (log.isDebugEnabled())
@@ -859,6 +864,9 @@ public final class IgfsImpl implements IgfsEx {
@Override public Collection<IgfsFile> listFiles(final IgfsPath path) {
A.notNull(path, "path");
+ if (meta.isClient())
+ meta.runClientTask(new IgfsClientListFilesCallable(cfg.getName(), path));
+
return safeOp(new Callable<Collection<IgfsFile>>() {
@Override public Collection<IgfsFile> call() throws Exception {
if (log.isDebugEnabled())
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
index ef556ae..c1b8be8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientDeleteCallable.java
@@ -26,7 +26,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
/**
- * IGFS client file IDs callable.
+ * IGFS client delete callable.
*/
public class IgfsClientDeleteCallable extends IgfsClientAbstractCallable<Boolean> {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
index d9e38c6..04b63d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientExistsCallable.java
@@ -23,7 +23,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
/**
- * IGFS client file IDs callable.
+ * IGFS client exists callable.
*/
public class IgfsClientExistsCallable extends IgfsClientAbstractCallable<Boolean> {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
index d954e78..f97c3c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientInfoCallable.java
@@ -24,7 +24,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
/**
- * IGFS client file IDs callable.
+ * IGFS client info callable.
*/
public class IgfsClientInfoCallable extends IgfsClientAbstractCallable<IgfsFile> {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
new file mode 100644
index 0000000..325e714
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListFilesCallable.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.igfs.client;
+
+import org.apache.ignite.igfs.IgfsFile;
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+/**
+ * IGFS client list files callable.
+ */
+public class IgfsClientListFilesCallable extends IgfsClientAbstractCallable<Collection<IgfsFile>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Default constructor.
+ */
+ public IgfsClientListFilesCallable() {
+ // NO-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param igfsName IGFS name.
+ * @param path Path.
+ */
+ public IgfsClientListFilesCallable(@Nullable String igfsName, IgfsPath path) {
+ super(igfsName, path);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<IgfsFile> call0(IgfsContext ctx) throws Exception {
+ return ctx.igfs().listFiles(path);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgfsClientListFilesCallable.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e5063493/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
new file mode 100644
index 0000000..78b4c84
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/client/IgfsClientListPathsCallable.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.igfs.client;
+
+import org.apache.ignite.igfs.IgfsPath;
+import org.apache.ignite.internal.processors.igfs.IgfsContext;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+/**
+ * IGFS client list paths callable.
+ */
+public class IgfsClientListPathsCallable extends IgfsClientAbstractCallable<Collection<IgfsPath>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Default constructor.
+ */
+ public IgfsClientListPathsCallable() {
+ // NO-op.
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param igfsName IGFS name.
+ * @param path Path.
+ */
+ public IgfsClientListPathsCallable(@Nullable String igfsName, IgfsPath path) {
+ super(igfsName, path);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Collection<IgfsPath> call0(IgfsContext ctx) throws Exception {
+ return ctx.igfs().listPaths(path);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IgfsClientListPathsCallable.class, this);
+ }
+}