ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject incubator-ignite git commit: ignite-637: extract separate class for public API
Date Wed, 08 Apr 2015 11:36:07 GMT
Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-635 [created] 0496d17ff


ignite-637: extract separate class for public API


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

Branch: refs/heads/ignite-635
Commit: 0496d17ffb7f3e56eb2707c10c528729e68a080b
Parents: f11e357
Author: Artem Shutak <ashutak@gridgain.com>
Authored: Wed Apr 8 14:36:05 2015 +0300
Committer: Artem Shutak <ashutak@gridgain.com>
Committed: Wed Apr 8 14:36:05 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/IgniteCluster.java   |  9 +-
 .../java/org/apache/ignite/StartHostResult.java | 86 ++++++++++++++++++++
 .../cluster/IgniteClusterAsyncImpl.java         | 36 +++++++-
 .../internal/cluster/IgniteClusterImpl.java     | 36 +++++++-
 4 files changed, 154 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0496d17f/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
index 7d7d2fb..a4c1383 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCluster.java
@@ -19,7 +19,6 @@ package org.apache.ignite;
 
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
-import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.lang.*;
 import org.jetbrains.annotations.*;
 
@@ -170,12 +169,12 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport
{
      *      nodes on the host than expected.
      * @param timeout Connection timeout.
      * @param maxConn Number of parallel SSH connections to one host.
-     * @return Collection of tuples, each containing host name, result (success of failure)
+     * @return Collection of start host results, each containing host name, result (success
or failure)
      *      and error message (if any).
      * @throws IgniteException In case of error.
      */
     @IgniteAsyncSupported
-    public Collection<GridTuple3<String, Boolean, String>> startNodes(File file,
boolean restart, int timeout,
+    public Collection<StartHostResult> startNodes(File file, boolean restart, int timeout,
         int maxConn) throws IgniteException;
 
     /**
@@ -272,12 +271,12 @@ public interface IgniteCluster extends ClusterGroup, IgniteAsyncSupport
{
      *      nodes on the host than expected.
      * @param timeout Connection timeout in milliseconds.
      * @param maxConn Number of parallel SSH connections to one host.
-     * @return Collection of tuples, each containing host name, result (success of failure)
+     * @return Collection of start host results, each containing host name, result (success
or failure)
      *      and error message (if any).
      * @throws IgniteException In case of error.
      */
     @IgniteAsyncSupported
-    public Collection<GridTuple3<String, Boolean, String>> startNodes(Collection<Map<String,
Object>> hosts,
+    public Collection<StartHostResult> startNodes(Collection<Map<String, Object>>
hosts,
         @Nullable Map<String, Object> dflts, boolean restart, int timeout, int maxConn)
throws IgniteException;
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0496d17f/modules/core/src/main/java/org/apache/ignite/StartHostResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/StartHostResult.java b/modules/core/src/main/java/org/apache/ignite/StartHostResult.java
new file mode 100644
index 0000000..f36bbfd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/StartHostResult.java
@@ -0,0 +1,86 @@
+/*
+ * 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;
+
+/**
+ * Start host result information.
+ */
+public class StartHostResult {
+    /** Host name. */
+    private String hostName;
+    
+    /** Result (success or failure). */
+    private boolean success;
+
+    /** Error message (if any) */
+    private String error;
+
+    /**
+     * Gets host name.
+     *  
+     * @return Host name.
+     */
+    public String getHostName() {
+        return hostName;
+    }
+
+    /**
+     * Sets host name.
+     *  
+     * @param hostName Host name.
+     */
+    public void setHostName(String hostName) {
+        this.hostName = hostName;
+    }
+
+    /**
+     * Gets result of success or failure.
+     *  
+     * @return Success or failure. <code>true</code> if success.
+     */
+    public boolean isSuccess() {
+        return success;
+    }
+
+    /**
+     * Sets success result.
+     *  
+     * @param success Success result.
+     */
+    public void setSuccess(boolean success) {
+        this.success = success;
+    }
+
+    /**
+     * Gets error message if any.
+     *  
+     * @return Error massage.
+     */
+    public String getError() {
+        return error;
+    }
+
+    /**
+     * Sets error message.
+     *  
+     * @param error Error message.
+     */
+    public void setError(String error) {
+        this.error = error;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0496d17f/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
index 5a5daab..e3d6f60 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterAsyncImpl.java
@@ -98,13 +98,27 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(File
file,
+    @Override public Collection<StartHostResult> startNodes(File file,
         boolean restart,
         int timeout,
         int maxConn)
     {
         try {
-            return saveOrGet(cluster.startNodesAsync(file, restart, timeout, maxConn));
+            Collection<GridTuple3<String, Boolean, String>> tuples = saveOrGet(cluster.startNodesAsync(file,
restart, timeout, maxConn));
+
+            Collection<StartHostResult> res = new ArrayList<>();
+
+            for (GridTuple3<String, Boolean, String> t : tuples) {
+                StartHostResult r = new StartHostResult();
+
+                r.setHostName(t.get1());
+                r.setSuccess(t.get2());
+                r.setError(t.get3());
+
+                res.add(r);
+            }
+
+            return res;
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -112,7 +126,7 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(
+    @Override public Collection<StartHostResult> startNodes(
         Collection<Map<String, Object>> hosts,
         @Nullable Map<String, Object> dflts,
         boolean restart,
@@ -120,7 +134,21 @@ public class IgniteClusterAsyncImpl extends AsyncSupportAdapter<IgniteCluster>
         int maxConn)
     {
         try {
-            return saveOrGet(cluster.startNodesAsync(hosts, dflts, restart, timeout, maxConn));
+            Collection<GridTuple3<String, Boolean, String>> tuples = saveOrGet(cluster.startNodesAsync(hosts,
dflts, restart, timeout, maxConn));
+
+            Collection<StartHostResult> res = new ArrayList<>();
+
+            for (GridTuple3<String, Boolean, String> t : tuples) {
+                StartHostResult r = new StartHostResult();
+
+                r.setHostName(t.get1());
+                r.setSuccess(t.get2());
+                r.setError(t.get3());
+
+                res.add(r);
+            }
+
+            return res;
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0496d17f/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
index 76a49dd..73a6e5b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/cluster/IgniteClusterImpl.java
@@ -189,14 +189,28 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements
IgniteClus
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(File
file,
+    @Override public Collection<StartHostResult> startNodes(File file,
         boolean restart,
         int timeout,
         int maxConn)
         throws IgniteException
     {
         try {
-            return startNodesAsync(file, restart, timeout, maxConn).get();
+            Collection<GridTuple3<String, Boolean, String>> tuples = startNodesAsync(file,
restart, timeout, maxConn).get();
+
+            Collection<StartHostResult> res = new ArrayList<>();
+
+            for (GridTuple3<String, Boolean, String> t : tuples) {
+                StartHostResult r = new StartHostResult();
+
+                r.setHostName(t.get1());
+                r.setSuccess(t.get2());
+                r.setError(t.get3());
+
+                res.add(r);
+            }
+
+            return res;
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);
@@ -204,7 +218,7 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements
IgniteClus
     }
 
     /** {@inheritDoc} */
-    @Override public Collection<GridTuple3<String, Boolean, String>> startNodes(Collection<Map<String,
Object>> hosts,
+    @Override public Collection<StartHostResult> startNodes(Collection<Map<String,
Object>> hosts,
         @Nullable Map<String, Object> dflts,
         boolean restart,
         int timeout,
@@ -212,7 +226,21 @@ public class IgniteClusterImpl extends ClusterGroupAdapter implements
IgniteClus
         throws IgniteException
     {
         try {
-            return startNodesAsync(hosts, dflts, restart, timeout, maxConn).get();
+            Collection<GridTuple3<String, Boolean, String>> tuples = startNodesAsync(hosts,
dflts, restart, timeout, maxConn).get();
+
+            Collection<StartHostResult> res = new ArrayList<>();
+
+            for (GridTuple3<String, Boolean, String> t : tuples) {
+                StartHostResult r = new StartHostResult();
+
+                r.setHostName(t.get1());
+                r.setSuccess(t.get2());
+                r.setError(t.get3());
+
+                res.add(r);
+            }
+
+            return res;
         }
         catch (IgniteCheckedException e) {
             throw U.convertException(e);


Mime
View raw message