You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/07/26 10:53:17 UTC
[01/19] ignite git commit: removed excluding ML sources from assembly
file - Fixes #2310.
Repository: ignite
Updated Branches:
refs/heads/ignite-5578 39f668e14 -> d3ec50a49
removed excluding ML sources from assembly file - Fixes #2310.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/219f2894
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/219f2894
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/219f2894
Branch: refs/heads/ignite-5578
Commit: 219f28948d22a36f9292ae34b02e18171486d3cc
Parents: 1a2dde9
Author: oleg-ostanin <oo...@gridgain.com>
Authored: Mon Jul 17 16:29:16 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jul 17 16:29:16 2017 +0300
----------------------------------------------------------------------
assembly/release-fabric-base.xml | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/219f2894/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index 7484dfa..5007785 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -239,7 +239,6 @@
<excludes>
<exclude>**/package.html</exclude>
<exclude>src/test/**</exclude>
- <exclude>src/main/ml/**</exclude>
</excludes>
</fileSet>
[06/19] ignite git commit: ignite-2.1.3 Merged with ignite-2.1.2.
Posted by sb...@apache.org.
ignite-2.1.3 Merged with ignite-2.1.2.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/03f02d30
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/03f02d30
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/03f02d30
Branch: refs/heads/ignite-5578
Commit: 03f02d30fda66ed12b3bd8b3af0671fa69b2b298
Parents: abc6e46 e88fcd8
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Mon Jul 24 13:49:32 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Mon Jul 24 13:49:32 2017 +0700
----------------------------------------------------------------------
examples/pom.xml | 7 +++++++
modules/geospatial/pom.xml | 24 ++++++++++++++++++++++++
modules/hibernate-4.2/pom.xml | 24 ++++++++++++++++++++++++
modules/hibernate-5.1/pom.xml | 24 ++++++++++++++++++++++++
modules/schedule/pom.xml | 24 ++++++++++++++++++++++++
5 files changed, 103 insertions(+)
----------------------------------------------------------------------
[17/19] ignite git commit: IGNITE-5278: BLAS implemented.
Posted by sb...@apache.org.
IGNITE-5278: BLAS implemented.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/de259fff
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/de259fff
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/de259fff
Branch: refs/heads/ignite-5578
Commit: de259fffb7fa5c0f8f6f7eeb84b86f296fe3bde9
Parents: 1318472
Author: Yury Babak <yb...@gridgain.com>
Authored: Tue Jul 25 20:19:27 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Tue Jul 25 20:19:27 2017 +0300
----------------------------------------------------------------------
LICENSE | 7 +
.../ml/math/matrix/ExampleMatrixStorage.java | 6 +-
modules/ml/README.txt | 6 +
modules/ml/licenses/bsd3.txt | 51 ++
modules/ml/pom.xml | 22 +
.../java/org/apache/ignite/ml/math/Blas.java | 484 +++++++++++++++++++
.../java/org/apache/ignite/ml/math/Matrix.java | 31 ++
.../apache/ignite/ml/math/MatrixStorage.java | 2 +-
.../apache/ignite/ml/math/OrderedMatrix.java | 24 +
.../java/org/apache/ignite/ml/math/Vector.java | 8 +
.../decompositions/CholeskyDecomposition.java | 11 +-
.../IgniteIntDoubleToDoubleBiFunction.java | 27 ++
.../functions/IgniteIntIntToIntBiFunction.java | 27 ++
.../ml/math/functions/IgniteTriFunction.java | 35 ++
.../ml/math/impls/matrix/AbstractMatrix.java | 94 +++-
.../impls/matrix/DenseLocalOnHeapMatrix.java | 61 ++-
.../impls/matrix/SparseLocalOnHeapMatrix.java | 27 ++
.../storage/matrix/ArrayMatrixStorage.java | 78 ++-
.../matrix/DenseOffHeapMatrixStorage.java | 2 +-
.../storage/matrix/MatrixDelegateStorage.java | 2 +-
.../matrix/SparseDistributedMatrixStorage.java | 4 +-
.../matrix/SparseLocalOnHeapMatrixStorage.java | 18 +
.../vector/SparseLocalOnHeapVectorStorage.java | 6 +
.../impls/vector/AbstractReadOnlyVector.java | 6 +
.../ml/math/impls/vector/AbstractVector.java | 8 +
.../ml/math/impls/vector/DelegatingVector.java | 6 +
.../ml/math/impls/vector/SparseLocalVector.java | 39 ++
.../apache/ignite/ml/math/util/MatrixUtil.java | 48 ++
.../KMeansDistributedClustererTest.java | 15 +-
.../org/apache/ignite/ml/math/BlasTest.java | 357 ++++++++++++++
.../ignite/ml/math/MathImplMainTestSuite.java | 3 +-
.../impls/matrix/MatrixViewConstructorTest.java | 2 +-
.../storage/matrix/MatrixArrayStorageTest.java | 6 +-
33 files changed, 1475 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/LICENSE
----------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index c971434..6e77825 100644
--- a/LICENSE
+++ b/LICENSE
@@ -220,6 +220,13 @@ This product bundles SnapTree, which is available under a
https://github.com/nbronson/snaptree/blob/master/LICENSE.
==============================================================================
+For netlib-java:
+==============================================================================
+This product bundles netlib-java, which is available under a
+"3-clause BSD" license. For details, see
+https://github.com/fommil/netlib-java/blob/master/LICENSE.txt.
+
+==============================================================================
For JSR 166 classes in "org.jsr166" package
==============================================================================
This product bundles JSR-166 classes which are donated to public domain.
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/examples/src/main/ml/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java
----------------------------------------------------------------------
diff --git a/examples/src/main/ml/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java b/examples/src/main/ml/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java
index 5dedfbf..1ccb2e2 100644
--- a/examples/src/main/ml/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java
+++ b/examples/src/main/ml/org/apache/ignite/examples/ml/math/matrix/ExampleMatrixStorage.java
@@ -23,7 +23,9 @@ import java.io.ObjectOutput;
import java.util.Arrays;
import org.apache.ignite.ml.math.MatrixStorage;
+import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.impls.storage.matrix.ArrayMatrixStorage;
+import org.apache.ignite.ml.math.util.MatrixUtil;
/**
* Example matrix storage implementation, modeled after {@link ArrayMatrixStorage}.
@@ -117,8 +119,8 @@ class ExampleMatrixStorage implements MatrixStorage {
}
/** {@inheritDoc} */
- @Override public double[][] data() {
- return data;
+ @Override public double[] data() {
+ return MatrixUtil.flatten(data, StorageConstants.ROW_STORAGE_MODE);
}
/** {@inheritDoc */
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/README.txt
----------------------------------------------------------------------
diff --git a/modules/ml/README.txt b/modules/ml/README.txt
index e0cc093..e85b7a0 100644
--- a/modules/ml/README.txt
+++ b/modules/ml/README.txt
@@ -12,4 +12,10 @@ Based on ideas from Apache Mahout.
Run from project root:
mvn clean package -Pml -DskipTests -pl modules/ml -am
+Apache binary releases cannot include LGPL dependencies. If you would like to activate native BLAS optimizations
+into your build, you should download the source release
+from Ignite website and do the build with the following maven command:
+
+mvn clean package -Pml,lgpl -DskipTests -pl modules/ml -am
+
Find generated jars in target folder.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/licenses/bsd3.txt
----------------------------------------------------------------------
diff --git a/modules/ml/licenses/bsd3.txt b/modules/ml/licenses/bsd3.txt
new file mode 100644
index 0000000..d6b30c1
--- /dev/null
+++ b/modules/ml/licenses/bsd3.txt
@@ -0,0 +1,51 @@
+This product binaries redistribute netlib-java which is available under the following license:
+
+Copyright (c) 2013 Samuel Halliday
+Copyright (c) 1992-2011 The University of Tennessee and The University
+ of Tennessee Research Foundation. All rights
+ reserved.
+Copyright (c) 2000-2011 The University of California Berkeley. All
+ rights reserved.
+Copyright (c) 2006-2011 The University of Colorado Denver. All rights
+ reserved.
+
+$COPYRIGHT$
+
+Additional copyrights may follow
+
+$HEADER$
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+- Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer listed
+ in this license in the documentation and/or other materials
+ provided with the distribution.
+
+- Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+The copyright holders provide no reassurances that the source code
+provided does not infringe any patent, copyright, or any other
+intellectual property rights of third parties. The copyright holders
+disclaim any liability to any recipient for claims brought against
+recipient by any third party for infringement of that parties
+intellectual property rights.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ml/pom.xml b/modules/ml/pom.xml
index d619719..478d8c4 100644
--- a/modules/ml/pom.xml
+++ b/modules/ml/pom.xml
@@ -36,6 +36,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <netlibjava.version>1.1.2</netlibjava.version>
</properties>
<dependencies>
@@ -88,6 +89,13 @@
</dependency>
<dependency>
+ <groupId>com.github.fommil.netlib</groupId>
+ <artifactId>core</artifactId>
+ <version>${netlibjava.version}</version>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-rng-core</artifactId>
<version>1.0</version>
@@ -101,6 +109,20 @@
</dependencies>
+ <profiles>
+ <profile>
+ <id>lgpl</id>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.github.fommil.netlib</groupId>
+ <artifactId>all</artifactId>
+ <version>${netlibjava.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<build>
<plugins>
<plugin>
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/Blas.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/Blas.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/Blas.java
new file mode 100644
index 0000000..57f994e
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/Blas.java
@@ -0,0 +1,484 @@
+/*
+ * 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.ml.math;
+
+import com.github.fommil.netlib.BLAS;
+import com.github.fommil.netlib.F2jBLAS;
+import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
+import it.unimi.dsi.fastutil.ints.IntIterator;
+import it.unimi.dsi.fastutil.ints.IntSet;
+import java.util.Set;
+import org.apache.ignite.ml.math.exceptions.CardinalityException;
+import org.apache.ignite.ml.math.exceptions.MathIllegalArgumentException;
+import org.apache.ignite.ml.math.exceptions.NonSquareMatrixException;
+import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.matrix.SparseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.impls.vector.SparseLocalVector;
+
+/**
+ * Useful subset of BLAS operations.
+ * This class is based on 'BLAS' class from Apache Spark MLlib.
+ */
+public class Blas {
+ /** F2J implementation of BLAS. */
+ transient static private BLAS f2jBlas = new F2jBLAS();
+
+ /** Native implementation of BLAS. F2J implementation will be used as fallback if no native implementation is found
+ */
+ transient static private BLAS nativeBlas = BLAS.getInstance();
+
+ /**
+ * Performs y += a * x
+ *
+ * @param a Scalar a.
+ * @param x Vector x.
+ * @param y Vector y.
+ */
+ public static void axpy(Double a, Vector x, Vector y) {
+ if (x.size() != y.size())
+ throw new CardinalityException(x.size(), y.size());
+
+ if (x.isArrayBased() && y.isArrayBased())
+ axpy(a, x.getStorage().data(), y.getStorage().data());
+ else if (x instanceof SparseLocalVector && y.isArrayBased())
+ axpy(a, (SparseLocalVector)x, y.getStorage().data());
+ else
+ throw new MathIllegalArgumentException("Operation 'axpy' doesn't support this combination of parameters [x="
+ + x.getClass().getName() + ", y="+y.getClass().getName()+"].");
+ }
+
+ /** */
+ private static void axpy(Double a, double[] x, double[] y) {
+ f2jBlas.daxpy(x.length, a, x, 1, y, 1);
+ }
+
+ /** */
+ private static void axpy(Double a, SparseLocalVector x, double[] y) {
+ int xSize = x.size();
+
+ if (a == 1.0) {
+ int k = 0;
+
+ while (k < xSize) {
+ y[k] += x.getX(k);
+ k++;
+ }
+ } else {
+ int k = 0;
+
+ while (k < xSize) {
+ y[k] += a * x.getX(k);
+ k++;
+ }
+ }
+ }
+
+ /**
+ * Returns dot product of vectors x and y.
+ *
+ * @param x Vector x.
+ * @param y Vector y.
+ * @return Dot product of x and y.
+ **/
+ public static Double dot(Vector x, Vector y) {
+ return x.dot(y);
+ }
+
+ /**
+ * Copies Vector x into Vector y. (y = x)
+ *
+ * @param x Vector x.
+ * @param y Vector y.
+ */
+ public void copy(Vector x, Vector y) {
+ int n = y.size();
+
+ if (x.size() != n)
+ throw new CardinalityException(x.size(), n);
+
+ if (y.isArrayBased()) {
+ double[] yData = y.getStorage().data();
+
+ if (x.isArrayBased())
+ System.arraycopy(x.getStorage().data(), 0, y.getStorage().data(), 0, n);
+ else {
+ if (y instanceof SparseLocalVector) {
+ for (int i = 0; i < n; i++)
+ yData[i] = x.getX(i);
+ }
+ }
+ } else
+ throw new IllegalArgumentException("Vector y must be array based in copy.");
+ }
+
+
+ /**
+ * Performs in-place multiplication of vector x by a real scalar a. (x = a * x)
+ *
+ * @param a Scalar a.
+ * @param x Vector x.
+ **/
+ public static void scal(Double a, Vector x) {
+ if (x.isArrayBased())
+ f2jBlas.dscal(x.size(), a, x.getStorage().data(), 1);
+ else if (x instanceof SparseLocalVector) {
+ Set<Integer> indexes = ((SparseLocalVector)x).indexes();
+
+ for (Integer i : indexes)
+ x.compute(i, (ind, v) -> v * a);
+ } else
+ throw new IllegalArgumentException();
+ }
+
+ /**
+ * Adds alpha * v * v.t to a matrix in-place. This is the same as BLAS's ?SPR.
+ *
+ * @param u the upper triangular part of the matrix in a [[DenseVector]](column major)
+ */
+ public static void spr(Double alpha, DenseLocalOnHeapVector v, DenseLocalOnHeapVector u) {
+ nativeBlas.dspr("U", v.size(), alpha, v.getStorage().data(), 1, u.getStorage().data());
+ }
+
+ /** */
+ public static void spr(Double alpha, SparseLocalVector v, DenseLocalOnHeapVector u) {
+ int prevNonDfltInd = 0;
+ int startInd = 0;
+ double av;
+ double[] uData = u.getStorage().data();
+
+ for (Integer nonDefaultInd : v.indexes()) {
+ startInd += (nonDefaultInd - prevNonDfltInd) * (nonDefaultInd + prevNonDfltInd + 1) / 2;
+ av = alpha * v.get(nonDefaultInd);
+
+ for (Integer i : v.indexes())
+ if (i <= nonDefaultInd)
+ uData[startInd + i] += av * v.getX(i);
+
+ prevNonDfltInd = nonDefaultInd;
+ }
+ }
+
+ /**
+ * A := alpha * x * x^T + A
+ * @param alpha a real scalar that will be multiplied to x * x^T^.
+ * @param x the vector x that contains the n elements.
+ * @param a the symmetric matrix A. Size of n x n.
+ */
+ void syr(Double alpha, Vector x, DenseLocalOnHeapMatrix a) {
+ int mA = a.rowSize();
+ int nA = a.columnSize();
+
+ if (mA != nA)
+ throw new NonSquareMatrixException(mA, nA);
+
+ if (mA != x.size())
+ throw new CardinalityException(x.size(), mA);
+
+ // TODO: IGNITE-5535, Process DenseLocalOffHeapVector
+ if (x instanceof DenseLocalOnHeapVector)
+ syr(alpha, x, a);
+ else if (x instanceof SparseLocalVector)
+ syr(alpha, x, a);
+ else
+ throw new IllegalArgumentException("Operation 'syr' does not support vector [class="
+ + x.getClass().getName() + "].");
+ }
+
+ /** */
+ static void syr(Double alpha, DenseLocalOnHeapVector x, DenseLocalOnHeapMatrix a) {
+ int nA = a.rowSize();
+ int mA = a.columnSize();
+
+ nativeBlas.dsyr("U", x.size(), alpha, x.getStorage().data(), 1, a.getStorage().data(), nA);
+
+ // Fill lower triangular part of A
+ int i = 0;
+ while (i < mA) {
+ int j = i + 1;
+
+ while (j < nA) {
+ a.setX(i, j, a.getX(j, i));
+ j++;
+ }
+ i++;
+ }
+ }
+
+ /** */
+ public static void syr(Double alpha, SparseLocalVector x, DenseLocalOnHeapMatrix a) {
+ int mA = a.columnSize();
+
+ for (Integer i : x.indexes()) {
+ double mult = alpha * x.getX(i);
+ for (Integer j : x.indexes())
+ a.getStorage().data()[mA * i + j] += mult * x.getX(j);
+ }
+ }
+
+ /**
+ * For the moment we have no flags indicating if matrix is transposed or not. Therefore all dgemm parameters for
+ * transposition are equal to 'N'.
+ */
+ public static void gemm(Double alpha, Matrix a, DenseLocalOnHeapMatrix b, Double beta, DenseLocalOnHeapMatrix c) {
+ if (alpha == 0.0 && beta == 1.0)
+ return;
+ else if (alpha == 0.0)
+ scal(c, beta);
+ else {
+ if (a instanceof SparseLocalOnHeapMatrix)
+ gemm(alpha, (SparseLocalOnHeapMatrix)a, b, beta, c);
+ else if (a instanceof DenseLocalOnHeapMatrix) {
+ double[] fA = a.getStorage().data();
+ double[] fB = b.getStorage().data();
+ double[] fC = c.getStorage().data();
+
+ nativeBlas.dgemm("N", "N", a.rowSize(), b.columnSize(), a.columnSize(), alpha, fA,
+ a.rowSize(), fB, b.rowSize(), beta, fC, c.rowSize());
+ } else
+ throw new IllegalArgumentException("Operation 'gemm' doesn't support for matrix [class="
+ + a.getClass().getName() + "].");
+ }
+ }
+
+ /**
+ * C := alpha * A * B + beta * C
+ * For `SparseMatrix` A.
+ */
+ private static void gemm(Double alpha, SparseLocalOnHeapMatrix a, DenseLocalOnHeapMatrix b, Double beta,
+ DenseLocalOnHeapMatrix c) {
+ int mA = a.rowSize();
+ int nB = b.columnSize();
+ int kA = a.columnSize();
+ int kB = b.rowSize();
+
+ if (kA != kB)
+ throw new CardinalityException(kA, kB);
+
+ if (mA != c.rowSize())
+ throw new CardinalityException(mA, c.rowSize());
+
+ if (nB != c.columnSize())
+ throw new CardinalityException(nB, c.columnSize());
+
+ if (beta != 1.0)
+ scal(c, beta);
+
+ Int2ObjectArrayMap<IntSet> im = a.indexesMap();
+ IntIterator rowsIter = im.keySet().iterator();
+ int row;
+ // We use here this form of iteration instead of 'for' because of nextInt.
+ while (rowsIter.hasNext()) {
+ row = rowsIter.nextInt();
+
+ for (int colInd = 0; colInd < nB; colInd++) {
+ double sum = 0.0;
+
+ IntIterator kIter = im.get(row).iterator();
+ int k;
+
+ while (kIter.hasNext()) {
+ k = kIter.nextInt();
+ sum += a.get(row, k) * b.get(k, colInd) * alpha;
+ }
+
+ c.setX(row, colInd, c.getX(row, colInd) + sum);
+ }
+ }
+ }
+
+ /**
+ * y := alpha * A * x + beta * y.
+ *
+ * @param alpha Alpha.
+ * @param a Matrix a.
+ * @param x Vector x.
+ * @param beta Beta.
+ * @param y Vector y.
+ */
+ public static void gemv(double alpha, Matrix a, Vector x, double beta, DenseLocalOnHeapVector y) {
+ checkCardinality(a, x);
+ checkCardinality(a, y);
+
+ if (alpha == 0.0 && beta == 1.0)
+ return;
+
+ if (alpha == 0.0) {
+ scal(y, beta);
+ return;
+ }
+
+ if (a instanceof SparseLocalOnHeapMatrix && x instanceof DenseLocalOnHeapVector)
+ gemv(alpha, (SparseLocalOnHeapMatrix)a, (DenseLocalOnHeapVector)x, beta, y);
+ else if (a instanceof SparseLocalOnHeapMatrix && x instanceof SparseLocalVector)
+ gemv(alpha, (SparseLocalOnHeapMatrix)a, (SparseLocalVector)x, beta, y);
+ else if (a instanceof DenseLocalOnHeapMatrix && x instanceof DenseLocalOnHeapVector)
+ gemv(alpha, (DenseLocalOnHeapMatrix)a, (DenseLocalOnHeapVector)x, beta, y);
+ else if (a instanceof DenseLocalOnHeapMatrix && x instanceof SparseLocalVector)
+ gemv(alpha, (DenseLocalOnHeapMatrix)a, (SparseLocalVector)x, beta, y);
+ else
+ throw new IllegalArgumentException("Operation gemv doesn't support running thist input [matrix=" +
+ a.getClass().getSimpleName() + ", vector=" + x.getClass().getSimpleName()+"].");
+ }
+
+ /**
+ * y := alpha * A * x + beta * y.
+ *
+ * @param alpha Alpha.
+ * @param a Matrix a.
+ * @param x Vector x.
+ * @param beta Beta.
+ * @param y Vector y.
+ */
+ private static void gemv(double alpha, SparseLocalOnHeapMatrix a, DenseLocalOnHeapVector x, double beta,
+ DenseLocalOnHeapVector y) {
+
+ if (beta != 1.0)
+ scal(y, beta);
+
+ IntIterator rowIter = a.indexesMap().keySet().iterator();
+ while (rowIter.hasNext()) {
+ int row = rowIter.nextInt();
+
+ double sum = 0.0;
+ IntIterator colIter = a.indexesMap().get(row).iterator();
+ while (colIter.hasNext()) {
+ int col = colIter.nextInt();
+ sum += alpha * a.getX(row, col) * x.getX(col);
+ }
+
+ y.setX(row, y.getX(row) + sum);
+ }
+ }
+
+ /**
+ * y := alpha * A * x + beta * y.
+ *
+ * @param alpha Alpha.
+ * @param a Matrix a.
+ * @param x Vector x.
+ * @param beta Beta.
+ * @param y Vector y.
+ */
+ private static void gemv(double alpha, DenseLocalOnHeapMatrix a, DenseLocalOnHeapVector x, double beta,
+ DenseLocalOnHeapVector y) {
+ nativeBlas.dgemv("N", a.rowSize(), a.columnSize(), alpha, a.getStorage().data(), a.rowSize(), x.getStorage().data(), 1, beta,
+ y.getStorage().data(), 1);
+ }
+
+ /**
+ * y := alpha * A * x + beta * y.
+ *
+ * @param alpha Alpha.
+ * @param a Matrix a.
+ * @param x Vector x.
+ * @param beta Beta.
+ * @param y Vector y.
+ */
+ private static void gemv(double alpha, SparseLocalOnHeapMatrix a, SparseLocalVector x, double beta,
+ DenseLocalOnHeapVector y) {
+
+
+ if (beta != 1.0)
+ scal(y, beta);
+
+ IntIterator rowIter = a.indexesMap().keySet().iterator();
+ while (rowIter.hasNext()) {
+ int row = rowIter.nextInt();
+
+ double sum = 0.0;
+ IntIterator colIter = a.indexesMap().get(row).iterator();
+ while (colIter.hasNext()) {
+ int col = colIter.nextInt();
+
+ sum += alpha * a.getX(row, col) * x.getX(col);
+ }
+
+ y.set(row, y.get(row) + sum);
+ }
+ }
+
+ /**
+ * y := alpha * A * x + beta * y.
+ *
+ * @param alpha Alpha.
+ * @param a Matrix a.
+ * @param x Vector x.
+ * @param beta Beta.
+ * @param y Vector y.
+ */
+ private static void gemv(double alpha, DenseLocalOnHeapMatrix a, SparseLocalVector x, double beta,
+ DenseLocalOnHeapVector y) {
+ int rowCntrForA = 0;
+ int mA = a.rowSize();
+
+ double[] aData = a.getStorage().data();
+
+ IntSet indexes = x.indexes();
+
+ double[] yValues = y.getStorage().data();
+
+ while (rowCntrForA < mA) {
+ double sum = 0.0;
+
+ IntIterator iter = indexes.iterator();
+ while (iter.hasNext()) {
+ int xIdx = iter.nextInt();
+ sum += x.getX(xIdx) * aData[xIdx * mA + rowCntrForA];
+ }
+
+ yValues[rowCntrForA] = sum * alpha + beta * yValues[rowCntrForA];
+ rowCntrForA++;
+ }
+ }
+
+ /**
+ * M := alpha * M.
+ * @param m Matrix M.
+ * @param alpha Aplha.
+ */
+ private static void scal(Matrix m, double alpha) {
+ if (alpha != 1.0)
+ for (int i = 0; i < m.rowSize(); i++)
+ for (int j = 0; j < m.columnSize(); j++)
+ m.setX(i, j, m.getX(i, j) * alpha);
+
+ }
+
+ /**
+ * v := alpha * v.
+ * @param v Vector v.
+ * @param alpha Aplha.
+ */
+ private static void scal(Vector v, double alpha) {
+ if (alpha != 1.0)
+ for (int i = 0; i < v.size(); i++)
+ v.compute(i, (ind, val) -> val * alpha);
+ }
+
+ /**
+ * Checks if Matrix A can be multiplied by vector v, if not CardinalityException is thrown.
+ *
+ * @param a Matrix A.
+ * @param v Vector v.
+ */
+ public static void checkCardinality(Matrix a, Vector v) throws CardinalityException {
+ if (a.columnSize() != v.size())
+ throw new CardinalityException(a.columnSize(), v.size());
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java
index 2cf4e63..66de1a1 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/Matrix.java
@@ -18,6 +18,7 @@
package org.apache.ignite.ml.math;
import java.io.Externalizable;
+import java.util.Spliterator;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.exceptions.IndexException;
@@ -25,6 +26,7 @@ import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
+import org.apache.ignite.ml.math.functions.IgniteTriFunction;
import org.apache.ignite.ml.math.functions.IntIntToDoubleFunction;
/**
@@ -187,6 +189,27 @@ public interface Matrix extends MetaAttributes, Externalizable, StorageOpsMetric
public Matrix map(Matrix mtx, IgniteBiFunction<Double, Double, Double> fun);
/**
+ * Gets number of non-zero elements in this matrix.
+ *
+ * @return Number of non-zero elements in this matrix.
+ */
+ public int nonZeroElements();
+
+ /**
+ * Gets spliterator for all values in this matrix.
+ *
+ * @return Spliterator for all values.
+ */
+ public Spliterator<Double> allSpliterator();
+
+ /**
+ * Gets spliterator for all non-zero values in this matrix.
+ *
+ * @return Spliterator for all non-zero values.
+ */
+ public Spliterator<Double> nonZeroSpliterator();
+
+ /**
* Assigns values from given vector to the specified column in this matrix.
*
* @param col Column index.
@@ -515,4 +538,12 @@ public interface Matrix extends MetaAttributes, Externalizable, StorageOpsMetric
public default void destroy() {
// No-op.
}
+
+ /**
+ * Replace matrix entry with value oldVal at (row, col) with result of computing f(row, col, oldVal).
+ * @param row Row.
+ * @param col Column.
+ * @param f Function used for replacing.
+ */
+ public void compute(int row, int col, IgniteTriFunction<Integer, Integer, Double, Double> f);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java
index ccfebe5..3b905bc 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/MatrixStorage.java
@@ -52,7 +52,7 @@ public interface MatrixStorage extends Externalizable, StorageOpsMetrics, Destro
*
* @see StorageOpsMetrics#isArrayBased()
*/
- default public double[][] data() {
+ default public double[] data() {
return null;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/OrderedMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/OrderedMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/OrderedMatrix.java
new file mode 100644
index 0000000..2c3acc8
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/OrderedMatrix.java
@@ -0,0 +1,24 @@
+/*
+ * 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.ml.math;
+
+/** Interface for matrix with particular order for storing entities. */
+public interface OrderedMatrix {
+ /** Get access mode. */
+ public int accessMode();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java
index e1c5df0..5fd39af 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/Vector.java
@@ -26,6 +26,7 @@ import org.apache.ignite.ml.math.exceptions.IndexException;
import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.ml.math.functions.IgniteIntDoubleToDoubleBiFunction;
/**
* A vector interface.
@@ -496,4 +497,11 @@ public interface Vector extends MetaAttributes, Externalizable, StorageOpsMetric
* @return Vector GUID.
*/
public IgniteUuid guid();
+
+ /**
+ * Replace vector entry with value oldVal at i with result of computing f(i, oldVal).
+ * @param i Position.
+ * @param f Function used for replacing.
+ **/
+ public void compute(int i, IgniteIntDoubleToDoubleBiFunction f);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
index 84028fe..73fbe2c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/CholeskyDecomposition.java
@@ -23,6 +23,7 @@ import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.exceptions.CardinalityException;
import org.apache.ignite.ml.math.exceptions.NonPositiveDefiniteMatrixException;
import org.apache.ignite.ml.math.exceptions.NonSymmetricMatrixException;
+import org.apache.ignite.ml.math.util.MatrixUtil;
import static org.apache.ignite.ml.math.util.MatrixUtil.like;
import static org.apache.ignite.ml.math.util.MatrixUtil.likeVector;
@@ -252,7 +253,7 @@ public class CholeskyDecomposition implements Destroyable {
throw new CardinalityException(b.rowSize(), m);
final int nColB = b.columnSize();
- final double[][] x = b.getStorage().data();
+ final double[][] x = MatrixUtil.unflatten(b.getStorage().data(), b.columnSize());
// Solve LY = b
for (int j = 0; j < m; j++) {
@@ -295,15 +296,13 @@ public class CholeskyDecomposition implements Destroyable {
/** */
private double[][] toDoubleArr(Matrix mtx) {
if (mtx.isArrayBased())
- return mtx.getStorage().data();
+ return MatrixUtil.unflatten(mtx.getStorage().data(), mtx.columnSize());
- double[][] res = new double[mtx.rowSize()][];
+ double[][] res = new double[mtx.rowSize()][mtx.columnSize()];
- for (int row = 0; row < mtx.rowSize(); row++) {
- res[row] = new double[mtx.columnSize()];
+ for (int row = 0; row < mtx.rowSize(); row++)
for (int col = 0; col < mtx.columnSize(); col++)
res[row][col] = mtx.get(row, col);
- }
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntDoubleToDoubleBiFunction.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntDoubleToDoubleBiFunction.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntDoubleToDoubleBiFunction.java
new file mode 100644
index 0000000..c9a91ae
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntDoubleToDoubleBiFunction.java
@@ -0,0 +1,27 @@
+/*
+ * 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.ml.math.functions;
+
+import java.io.Serializable;
+
+/** BiFunction (int, double) -> double. */
+@FunctionalInterface
+public interface IgniteIntDoubleToDoubleBiFunction extends Serializable {
+ /** */
+ public double apply(int x, double d);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntIntToIntBiFunction.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntIntToIntBiFunction.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntIntToIntBiFunction.java
new file mode 100644
index 0000000..bfd472c
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteIntIntToIntBiFunction.java
@@ -0,0 +1,27 @@
+/*
+ * 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.ml.math.functions;
+
+import java.io.Serializable;
+
+/** BiFunction (int, int) -> int. */
+@FunctionalInterface
+public interface IgniteIntIntToIntBiFunction extends Serializable {
+ /** */
+ public int apply(int x, int y);
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriFunction.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriFunction.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriFunction.java
new file mode 100644
index 0000000..3284a00
--- /dev/null
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/functions/IgniteTriFunction.java
@@ -0,0 +1,35 @@
+/*
+ * 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.ml.math.functions;
+
+import java.io.Serializable;
+import java.util.Objects;
+import java.util.function.Function;
+
+/** Serializable TriFunction (A, B, C) -> R. */
+@FunctionalInterface
+public interface IgniteTriFunction<A,B,C,R> extends Serializable {
+ /** */
+ R apply(A a, B b, C c);
+
+ /** */
+ default <V> IgniteTriFunction<A, B, C, V> andThen(Function<? super R, ? extends V> after) {
+ Objects.requireNonNull(after);
+ return (A a, B b, C c) -> after.apply(apply(a, b, c));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
index 647ebc6..e1efd0c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
@@ -24,6 +24,8 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
+import java.util.Spliterator;
+import java.util.function.Consumer;
import org.apache.ignite.lang.IgniteUuid;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.MatrixStorage;
@@ -36,6 +38,7 @@ import org.apache.ignite.ml.math.functions.Functions;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
+import org.apache.ignite.ml.math.functions.IgniteTriFunction;
import org.apache.ignite.ml.math.functions.IntIntToDoubleFunction;
import org.apache.ignite.ml.math.impls.vector.MatrixVectorView;
@@ -326,8 +329,7 @@ public abstract class AbstractMatrix implements Matrix {
/** {@inheritDoc} */
@Override public Matrix assign(double val) {
if (sto.isArrayBased())
- for (double[] column : sto.data())
- Arrays.fill(column, val);
+ Arrays.fill(sto.data(), val);
else {
int rows = rowSize();
int cols = columnSize();
@@ -421,6 +423,85 @@ public abstract class AbstractMatrix implements Matrix {
}
/** {@inheritDoc} */
+ @Override public Spliterator<Double> allSpliterator() {
+ return new Spliterator<Double>() {
+ /** {@inheritDoc} */
+ @Override public boolean tryAdvance(Consumer<? super Double> act) {
+ int rLen = rowSize();
+ int cLen = columnSize();
+
+ for (int i = 0; i < rLen; i++)
+ for (int j = 0; j < cLen; j++)
+ act.accept(storageGet(i, j));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Spliterator<Double> trySplit() {
+ return null; // No Splitting.
+ }
+
+ /** {@inheritDoc} */
+ @Override public long estimateSize() {
+ return rowSize() * columnSize();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int characteristics() {
+ return ORDERED | SIZED;
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
+ @Override public int nonZeroElements() {
+ int cnt = 0;
+
+ for (int i = 0; i < rowSize(); i++)
+ for (int j = 0; j < rowSize(); j++)
+ if (get(i, j) != 0.0)
+ cnt++;
+
+ return cnt;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Spliterator<Double> nonZeroSpliterator() {
+ return new Spliterator<Double>() {
+ /** {@inheritDoc} */
+ @Override public boolean tryAdvance(Consumer<? super Double> act) {
+ int rLen = rowSize();
+ int cLen = columnSize();
+
+ for (int i = 0; i < rLen; i++)
+ for (int j = 0; j < cLen; j++) {
+ double val = storageGet(i, j);
+
+ if (val != 0.0)
+ act.accept(val);
+ }
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Spliterator<Double> trySplit() {
+ return null; // No Splitting.
+ }
+
+ /** {@inheritDoc} */
+ @Override public long estimateSize() {
+ return nonZeroElements();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int characteristics() {
+ return ORDERED | SIZED;
+ }
+ };
+ }
+
+ /** {@inheritDoc} */
@Override public Matrix assignColumn(int col, Vector vec) {
checkColumnIndex(col);
@@ -442,7 +523,7 @@ public abstract class AbstractMatrix implements Matrix {
throw new CardinalityException(cols, vec.size());
if (sto.isArrayBased() && vec.getStorage().isArrayBased())
- System.arraycopy(vec.getStorage().data(), 0, sto.data()[row], 0, cols);
+ System.arraycopy(vec.getStorage().data(), 0, sto.data(), cols * row, cols);
else
for (int y = 0; y < cols; y++)
storageSet(row, y, vec.getX(y));
@@ -623,7 +704,7 @@ public abstract class AbstractMatrix implements Matrix {
throw new CardinalityException(cols, data.length);
if (sto.isArrayBased())
- System.arraycopy(data, 0, sto.data()[row], 0, cols);
+ System.arraycopy(data, 0, sto.data(), row * cols, cols);
else
for (int y = 0; y < cols; y++)
setX(row, y, data[y]);
@@ -880,4 +961,9 @@ public abstract class AbstractMatrix implements Matrix {
return (sto != null ? sto.equals(that.getStorage()) : that.getStorage() == null);
}
+
+ /** {@inheritDoc} */
+ @Override public void compute(int row, int col, IgniteTriFunction<Integer, Integer, Double, Double> f) {
+ setX(row, col, f.apply(row, col, getX(row, col)));
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java
index f95e0cc..393fff6 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/DenseLocalOnHeapMatrix.java
@@ -18,6 +18,8 @@
package org.apache.ignite.ml.math.impls.matrix;
import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.OrderedMatrix;
+import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.impls.storage.matrix.ArrayMatrixStorage;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
@@ -30,7 +32,7 @@ import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
* local, non-distributed execution is satisfactory and on-heap JVM storage is enough
* to keep the entire data set.
*/
-public class DenseLocalOnHeapMatrix extends AbstractMatrix {
+public class DenseLocalOnHeapMatrix extends AbstractMatrix implements OrderedMatrix {
/**
*
*/
@@ -43,44 +45,89 @@ public class DenseLocalOnHeapMatrix extends AbstractMatrix {
* @param cols Amount of columns in matrix.
*/
public DenseLocalOnHeapMatrix(int rows, int cols) {
+ this(rows, cols, StorageConstants.ROW_STORAGE_MODE);
+ }
+
+ /**
+ * @param rows Amount of rows in matrix.
+ * @param cols Amount of columns in matrix.
+ * @param acsMode Storage order (row or column-based).
+ */
+ public DenseLocalOnHeapMatrix(int rows, int cols, int acsMode) {
assert rows > 0;
assert cols > 0;
- setStorage(new ArrayMatrixStorage(rows, cols));
+ setStorage(new ArrayMatrixStorage(rows, cols, acsMode));
+ }
+
+ /**
+ * @param mtx Backing data array.
+ * @param acsMode Access mode.
+ */
+ public DenseLocalOnHeapMatrix(double[][] mtx, int acsMode) {
+ assert mtx != null;
+
+ setStorage(new ArrayMatrixStorage(mtx, acsMode));
}
/**
* @param mtx Backing data array.
*/
public DenseLocalOnHeapMatrix(double[][] mtx) {
+ this(mtx, StorageConstants.ROW_STORAGE_MODE);
+ }
+
+ /**
+ * @param mtx Backing data array.
+ * @param acsMode Access mode.
+ */
+ public DenseLocalOnHeapMatrix(double[] mtx, int rows, int acsMode) {
assert mtx != null;
- setStorage(new ArrayMatrixStorage(mtx));
+ setStorage(new ArrayMatrixStorage(mtx, rows, acsMode));
}
/**
- * @param orig Original matrix.
+ * Build new matrix from flat raw array.
*/
+ public DenseLocalOnHeapMatrix(double[] mtx, int rows) {
+ this(mtx, StorageConstants.ROW_STORAGE_MODE, rows);
+ }
+
+ /** */
private DenseLocalOnHeapMatrix(DenseLocalOnHeapMatrix orig) {
+ this(orig, orig.accessMode());
+ }
+
+ /**
+ * @param orig Original matrix.
+ * @param acsMode Access mode.
+ */
+ private DenseLocalOnHeapMatrix(DenseLocalOnHeapMatrix orig, int acsMode) {
assert orig != null;
- setStorage(new ArrayMatrixStorage(orig.rowSize(), orig.columnSize()));
+ setStorage(new ArrayMatrixStorage(orig.rowSize(), orig.columnSize(), acsMode));
assign(orig);
}
/** {@inheritDoc} */
@Override public Matrix copy() {
- return new DenseLocalOnHeapMatrix(this);
+ return new DenseLocalOnHeapMatrix(this, accessMode());
}
/** {@inheritDoc} */
@Override public Matrix like(int rows, int cols) {
- return new DenseLocalOnHeapMatrix(rows, cols);
+ return new DenseLocalOnHeapMatrix(rows, cols, getStorage() != null ? accessMode() : StorageConstants.ROW_STORAGE_MODE);
}
/** {@inheritDoc} */
@Override public Vector likeVector(int crd) {
return new DenseLocalOnHeapVector(crd);
}
+
+ /** */
+ @Override public int accessMode() {
+ return ((ArrayMatrixStorage)getStorage()).accessMode();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java
index d711295..d0a5937 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/SparseLocalOnHeapMatrix.java
@@ -17,10 +17,14 @@
package org.apache.ignite.ml.math.impls.matrix;
+import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
+import it.unimi.dsi.fastutil.ints.IntIterator;
+import it.unimi.dsi.fastutil.ints.IntSet;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.MatrixStorage;
import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.Vector;
+import org.apache.ignite.ml.math.functions.IgniteTriFunction;
import org.apache.ignite.ml.math.impls.storage.matrix.SparseLocalOnHeapMatrixStorage;
import org.apache.ignite.ml.math.impls.vector.SparseLocalVector;
@@ -62,6 +66,24 @@ public class SparseLocalOnHeapMatrix extends AbstractMatrix implements StorageCo
}
/** {@inheritDoc} */
+ @Override public int nonZeroElements() {
+ int res = 0;
+ IntIterator rowIter = indexesMap().keySet().iterator();
+
+ while (rowIter.hasNext()) {
+ int row = rowIter.nextInt();
+ res += indexesMap().get(row).size();
+ }
+
+ return res;
+ }
+
+ /** */
+ public Int2ObjectArrayMap<IntSet> indexesMap() {
+ return ((SparseLocalOnHeapMatrixStorage)getStorage()).indexesMap();
+ }
+
+ /** {@inheritDoc} */
@Override public Matrix copy() {
Matrix cp = like(rowSize(), columnSize());
@@ -69,4 +91,9 @@ public class SparseLocalOnHeapMatrix extends AbstractMatrix implements StorageCo
return cp;
}
+
+ /** {@inheritDoc} */
+ @Override public void compute(int row, int col, IgniteTriFunction<Integer, Integer, Double, Double> f) {
+ ((SparseLocalOnHeapMatrixStorage)getStorage()).compute(row, col, f);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java
index 397bf93..1f337fd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/ArrayMatrixStorage.java
@@ -22,17 +22,24 @@ import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.Arrays;
import org.apache.ignite.ml.math.MatrixStorage;
+import org.apache.ignite.ml.math.StorageConstants;
+import org.apache.ignite.ml.math.functions.IgniteIntIntToIntBiFunction;
+import org.apache.ignite.ml.math.util.MatrixUtil;
/**
* Array based {@link MatrixStorage} implementation.
*/
public class ArrayMatrixStorage implements MatrixStorage {
/** Backing data array. */
- private double[][] data;
+ private double[] data;
/** Amount of rows in the matrix. */
private int rows;
/** Amount of columns in the matrix. */
private int cols;
+ /** Mode specifying if this matrix is row-major or column-major. */
+ private int acsMode;
+ /** Index mapper */
+ private IgniteIntIntToIntBiFunction idxMapper;
/**
*
@@ -46,32 +53,62 @@ public class ArrayMatrixStorage implements MatrixStorage {
* @param cols Amount of columns in the matrix.
*/
public ArrayMatrixStorage(int rows, int cols) {
+ this(rows, cols, StorageConstants.ROW_STORAGE_MODE);
+ }
+
+ /** */
+ public ArrayMatrixStorage(int rows, int cols, int acsMode) {
assert rows > 0;
assert cols > 0;
- this.data = new double[rows][cols];
+ this.data = new double[rows * cols];
this.rows = rows;
this.cols = cols;
+ idxMapper = indexMapper(acsMode);
+ this.acsMode = acsMode;
+ }
+
+ /**
+ * @param data Backing data array.
+ */
+ public ArrayMatrixStorage(double[][] data, int acsMode) {
+ this(MatrixUtil.flatten(data, acsMode), data.length, acsMode);
}
/**
* @param data Backing data array.
*/
public ArrayMatrixStorage(double[][] data) {
+ this(MatrixUtil.flatten(data, StorageConstants.ROW_STORAGE_MODE), data.length);
+ }
+
+ /**
+ * @param data Backing data array.
+ */
+ public ArrayMatrixStorage(double[] data, int rows, int acsMode) {
assert data != null;
- assert data[0] != null;
+ assert data.length % rows == 0;
this.data = data;
- this.rows = data.length;
- this.cols = data[0].length;
+ this.rows = rows;
+ this.cols = data.length / rows;
+ idxMapper = indexMapper(acsMode);
+ this.acsMode = acsMode;
assert rows > 0;
assert cols > 0;
}
+ /**
+ * @param data Backing data array.
+ */
+ public ArrayMatrixStorage(double[] data, int rows) {
+ this(data, rows, StorageConstants.ROW_STORAGE_MODE);
+ }
+
/** {@inheritDoc} */
@Override public double get(int x, int y) {
- return data[x][y];
+ return data[idxMapper.apply(x, y)];
}
/** {@inheritDoc} */
@@ -96,7 +133,7 @@ public class ArrayMatrixStorage implements MatrixStorage {
/** {@inheritDoc} */
@Override public void set(int x, int y, double v) {
- data[x][y] = v;
+ data[idxMapper.apply(x, y)] = v;
}
/** {@inheritDoc} */
@@ -115,14 +152,25 @@ public class ArrayMatrixStorage implements MatrixStorage {
}
/** {@inheritDoc} */
- @Override public double[][] data() {
+ @Override public double[] data() {
return data;
}
+ /**
+ * Get the index mapper for given access mode.
+ *
+ * @param acsMode Access mode.
+ */
+ private IgniteIntIntToIntBiFunction indexMapper(int acsMode) {
+ return acsMode == StorageConstants.ROW_STORAGE_MODE ? (r, c) -> r * cols + c :
+ (r, c) -> c * rows + r;
+ }
+
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt(rows);
out.writeInt(cols);
+ out.writeInt(acsMode);
out.writeObject(data);
}
@@ -131,8 +179,15 @@ public class ArrayMatrixStorage implements MatrixStorage {
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
rows = in.readInt();
cols = in.readInt();
+ acsMode = in.readInt();
+ idxMapper = indexMapper(acsMode);
+
+ data = (double[])in.readObject();
+ }
- data = (double[][])in.readObject();
+ /** Get the access mode of this storage. */
+ public int accessMode() {
+ return acsMode;
}
/** {@inheritDoc} */
@@ -141,7 +196,8 @@ public class ArrayMatrixStorage implements MatrixStorage {
res += res * 37 + rows;
res += res * 37 + cols;
- res += res * 37 + Arrays.deepHashCode(data);
+ res += res * 37 + acsMode;
+ res += res * 37 + Arrays.hashCode(data);
return res;
}
@@ -156,6 +212,6 @@ public class ArrayMatrixStorage implements MatrixStorage {
ArrayMatrixStorage that = (ArrayMatrixStorage)o;
- return Arrays.deepEquals(data, that.data);
+ return acsMode == that.acsMode && Arrays.equals(data, that.data);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
index 7405a4e..f58da65 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
@@ -122,7 +122,7 @@ public class DenseOffHeapMatrixStorage implements MatrixStorage {
}
/** {@inheritDoc} */
- @Override public double[][] data() {
+ @Override public double[] data() {
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java
index 1f77d0f..f185479 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixDelegateStorage.java
@@ -150,7 +150,7 @@ public class MatrixDelegateStorage implements MatrixStorage {
}
/** {@inheritDoc} */
- @Override public double[][] data() {
+ @Override public double[] data() {
return sto.data();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
index 1513502..fc7d969 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseDistributedMatrixStorage.java
@@ -116,9 +116,7 @@ public class SparseDistributedMatrixStorage extends CacheUtils implements Matrix
// Random cache name.
cfg.setName(ML_CACHE_NAME);
- IgniteCache<IgniteBiTuple<Integer, IgniteUuid>, Map<Integer, Double>> cache = Ignition.localIgnite().getOrCreateCache(cfg);
-
- return cache;
+ return Ignition.localIgnite().getOrCreateCache(cfg);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
index b33cb26..daf1d4b 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/SparseLocalOnHeapMatrixStorage.java
@@ -19,6 +19,8 @@ package org.apache.ignite.ml.math.impls.storage.matrix;
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap;
+import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
+import it.unimi.dsi.fastutil.ints.IntSet;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -26,6 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.ignite.ml.math.MatrixStorage;
import org.apache.ignite.ml.math.StorageConstants;
+import org.apache.ignite.ml.math.functions.IgniteTriFunction;
/**
* Storage for sparse, local, on-heap matrix.
@@ -225,4 +228,19 @@ public class SparseLocalOnHeapMatrixStorage implements MatrixStorage, StorageCon
return rows == that.rows && cols == that.cols && acsMode == that.acsMode && stoMode == that.stoMode
&& (sto != null ? sto.equals(that.sto) : that.sto == null);
}
+
+ /** */
+ public void compute(int row, int col, IgniteTriFunction<Integer, Integer, Double, Double> f) {
+ sto.get(row).compute(col, (c, val) -> f.apply(row, c, val));
+ }
+
+ /** */
+ public Int2ObjectArrayMap<IntSet> indexesMap() {
+ Int2ObjectArrayMap<IntSet> res = new Int2ObjectArrayMap<>();
+
+ for (Integer row : sto.keySet())
+ res.put(row.intValue(), (IntSet)sto.get(row).keySet());
+
+ return res;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
index deef010..3323a07 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
@@ -19,6 +19,7 @@ package org.apache.ignite.ml.math.impls.storage.vector;
import it.unimi.dsi.fastutil.ints.Int2DoubleOpenHashMap;
import it.unimi.dsi.fastutil.ints.Int2DoubleRBTreeMap;
+import it.unimi.dsi.fastutil.ints.IntSet;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
@@ -178,4 +179,9 @@ public class SparseLocalOnHeapVectorStorage implements VectorStorage, StorageCon
return res;
}
+
+ /** */
+ public IntSet indexes() {
+ return (IntSet)sto.keySet();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractReadOnlyVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractReadOnlyVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractReadOnlyVector.java
index e48542b..1de334f 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractReadOnlyVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractReadOnlyVector.java
@@ -22,6 +22,7 @@ import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.VectorStorage;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.ml.math.functions.IgniteIntDoubleToDoubleBiFunction;
import org.apache.ignite.ml.math.impls.matrix.FunctionMatrix;
/**
@@ -122,4 +123,9 @@ public abstract class AbstractReadOnlyVector extends AbstractVector {
return new FunctionVector(size(), (idx) -> Math.log1p(get(idx)) / denominator);
}
+
+ /** {@inheritDoc} */
+ @Override public void compute(int idx, IgniteIntDoubleToDoubleBiFunction f) {
+ throw new UnsupportedOperationException();
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java
index 83ac837..131a610 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/AbstractVector.java
@@ -38,6 +38,7 @@ import org.apache.ignite.ml.math.exceptions.UnsupportedOperationException;
import org.apache.ignite.ml.math.functions.Functions;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.ml.math.functions.IgniteIntDoubleToDoubleBiFunction;
import org.apache.ignite.ml.math.impls.matrix.MatrixView;
import org.jetbrains.annotations.NotNull;
@@ -904,4 +905,11 @@ public abstract class AbstractVector implements Vector {
return (sto != null ? sto.equals(that.sto) : that.sto == null);
}
+
+ /** {@inheritDoc} */
+ @Override public void compute(int idx, IgniteIntDoubleToDoubleBiFunction f) {
+ storageSet(idx, f.apply(idx, storageGet(idx)));
+ lenSq = 0.0;
+ maxElm = minElm = null;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java
index 48fbd06..1df9acc 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/DelegatingVector.java
@@ -30,6 +30,7 @@ import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.VectorStorage;
import org.apache.ignite.ml.math.functions.IgniteBiFunction;
import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
+import org.apache.ignite.ml.math.functions.IgniteIntDoubleToDoubleBiFunction;
/**
* Convenient class that can be used to add decorations to an existing vector. Subclasses
@@ -367,6 +368,11 @@ public class DelegatingVector implements Vector {
}
/** {@inheritDoc} */
+ @Override public void compute(int i, IgniteIntDoubleToDoubleBiFunction f) {
+ dlg.compute(i, f);
+ }
+
+ /** {@inheritDoc} */
@Override public void destroy() {
dlg.destroy();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
index 9e345bb..bc1e59d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
@@ -17,7 +17,11 @@
package org.apache.ignite.ml.math.impls.vector;
+import it.unimi.dsi.fastutil.ints.IntSet;
import java.util.Map;
+import java.util.Set;
+import java.util.Spliterator;
+import java.util.function.Consumer;
import org.apache.ignite.ml.math.Matrix;
import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.Vector;
@@ -77,4 +81,39 @@ public class SparseLocalVector extends AbstractVector implements StorageConstant
else
return super.times(x);
}
+
+ /** Indexes of non-default elements. */
+ public IntSet indexes() {
+ return storage().indexes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Spliterator<Double> nonZeroSpliterator() {
+ return new Spliterator<Double>() {
+ /** {@inheritDoc} */
+ @Override public boolean tryAdvance(Consumer<? super Double> act) {
+ Set<Integer> indexes = storage().indexes();
+
+ for (Integer index : indexes)
+ act.accept(storageGet(index));
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Spliterator<Double> trySplit() {
+ return null; // No Splitting.
+ }
+
+ /** {@inheritDoc} */
+ @Override public long estimateSize() {
+ return storage().indexes().size();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int characteristics() {
+ return ORDERED | SIZED;
+ }
+ };
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
index 752929d..c727e44 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
@@ -20,12 +20,14 @@ package org.apache.ignite.ml.math.util;
import java.util.List;
import org.apache.ignite.internal.util.GridArgumentCheck;
import org.apache.ignite.ml.math.Matrix;
+import org.apache.ignite.ml.math.StorageConstants;
import org.apache.ignite.ml.math.Vector;
import org.apache.ignite.ml.math.impls.matrix.CacheMatrix;
import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.matrix.MatrixView;
import org.apache.ignite.ml.math.impls.matrix.PivotedMatrixView;
import org.apache.ignite.ml.math.impls.matrix.RandomMatrix;
+import org.apache.ignite.ml.math.impls.matrix.SparseLocalOnHeapMatrix;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
/**
@@ -116,6 +118,18 @@ public class MatrixUtil {
}
/** */
+ public static DenseLocalOnHeapMatrix asDense(SparseLocalOnHeapMatrix m, int acsMode) {
+ DenseLocalOnHeapMatrix res = new DenseLocalOnHeapMatrix(m.rowSize(), m.columnSize(), acsMode);
+
+ for (Integer row : m.indexesMap().keySet()) {
+ for (Integer col : m.indexesMap().get(row))
+ res.set(row, col, m.get(row, col));
+ }
+
+ return res;
+ }
+
+ /** */
private static boolean isCopyLikeSupport(Matrix matrix) {
return matrix instanceof RandomMatrix || matrix instanceof MatrixView || matrix instanceof CacheMatrix ||
matrix instanceof PivotedMatrixView;
@@ -152,4 +166,38 @@ public class MatrixUtil {
return res;
}
+
+ /** */
+ public static double[][] unflatten(double[] fArr, int colsCnt) {
+ int rowsCnt = fArr.length / colsCnt;
+
+ double[][] res = new double[rowsCnt][colsCnt];
+
+ for (int i = 0; i < rowsCnt; i++)
+ for (int j = 0; j < colsCnt; j++)
+ res[i][j] = fArr[i * colsCnt + j];
+
+ return res;
+ }
+
+ /** */
+ public static double[] flatten(double[][] arr, int acsMode) {
+ assert arr != null;
+ assert arr[0] != null;
+
+ int size = arr.length * arr[0].length;
+ int rows = acsMode == StorageConstants.ROW_STORAGE_MODE ? arr.length : arr[0].length;
+ int cols = size / rows;
+
+ double[] res = new double[size];
+
+ int iLim = acsMode == StorageConstants.ROW_STORAGE_MODE ? rows : cols;
+ int jLim = acsMode == StorageConstants.ROW_STORAGE_MODE ? cols : rows;
+
+ for (int i = 0; i < iLim; i++)
+ for (int j = 0; j < jLim; j++)
+ res[i * jLim + j] = arr[i][j];
+
+ return res;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTest.java
index cdc2651..a59b7f9 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/clustering/KMeansDistributedClustererTest.java
@@ -130,8 +130,8 @@ public class KMeansDistributedClustererTest extends GridCommonAbstractTest {
Vector[] mc = new Vector[centersCnt];
Arrays.fill(mc, VectorUtils.zeroes(2));
- int centIndex = 0;
- int totalCount = 0;
+ int centIdx = 0;
+ int totalCnt = 0;
List<Vector> massCenters = new ArrayList<>();
@@ -140,12 +140,12 @@ public class KMeansDistributedClustererTest extends GridCommonAbstractTest {
DenseLocalOnHeapVector pnt = (DenseLocalOnHeapVector)new DenseLocalOnHeapVector(2).assign(centers.get(count));
// pertrubate point on random value.
pnt.map(val -> val + rnd.nextDouble() * squareSideLen / 100);
- mc[centIndex] = mc[centIndex].plus(pnt);
- points.assignRow(permutation.get(totalCount), pnt);
- totalCount++;
+ mc[centIdx] = mc[centIdx].plus(pnt);
+ points.assignRow(permutation.get(totalCnt), pnt);
+ totalCnt++;
}
- massCenters.add(mc[centIndex].times(1 / (double)count));
- centIndex++;
+ massCenters.add(mc[centIdx].times(1 / (double)count));
+ centIdx++;
}
EuclideanDistance dist = new EuclideanDistance();
@@ -169,6 +169,7 @@ public class KMeansDistributedClustererTest extends GridCommonAbstractTest {
/** */
List<Vector> orderedNodes;
+ /** */
public OrderedNodesComparator(Vector[] orderedNodes, DistanceMeasure measure) {
this.orderedNodes = Arrays.asList(orderedNodes);
this.measure = measure;
[16/19] ignite git commit: IGNITE-5278: BLAS implemented.
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/test/java/org/apache/ignite/ml/math/BlasTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/BlasTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/BlasTest.java
new file mode 100644
index 0000000..00bce47
--- /dev/null
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/BlasTest.java
@@ -0,0 +1,357 @@
+/*
+ * 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.ml.math;
+
+import java.util.function.BiPredicate;
+import org.apache.ignite.ml.math.impls.matrix.DenseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.matrix.SparseLocalOnHeapMatrix;
+import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
+import org.apache.ignite.ml.math.impls.vector.SparseLocalVector;
+import org.apache.ignite.ml.math.util.MatrixUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+/** Tests for BLAS operations (all operations are only available for local matrices and vectors). */
+public class BlasTest {
+ /** Test 'axpy' operation for two array-based vectors. */
+ @Test
+ public void testAxpyArrayArray() {
+ Vector y = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ double a = 2.0;
+ Vector x = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+
+ Vector exp = x.times(a).plus(y);
+ Blas.axpy(a, x, y);
+
+ Assert.assertEquals(y, exp);
+ }
+
+ /** Test 'axpy' operation for sparse vector and array-based vector. */
+ @Test
+ public void testAxpySparseArray() {
+ DenseLocalOnHeapVector y = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ double a = 2.0;
+ SparseLocalVector x = sparseFromArray(new double[] {1.0, 2.0});
+
+ SparseLocalVector exp = (SparseLocalVector)x.times(a).plus(y);
+ Blas.axpy(a, x, y);
+
+ Assert.assertTrue(elementsEqual(exp, y));
+ }
+
+ /** Test 'dot' operation. */
+ @Test
+ public void testDot() {
+ DenseLocalOnHeapVector v1 = new DenseLocalOnHeapVector(new double[] {1.0, 1.0});
+ DenseLocalOnHeapVector v2 = new DenseLocalOnHeapVector(new double[] {2.0, 2.0});
+
+ Assert.assertEquals(Blas.dot(v1, v2), v1.dot(v2), 0.0);
+ }
+
+ /** Test 'scal' operation for dense matrix. */
+ @Test
+ public void testScalDense() {
+ double[] data = new double[] {1.0, 1.0};
+ double alpha = 2.0;
+
+ DenseLocalOnHeapVector v = new DenseLocalOnHeapVector(data);
+ Vector exp = new DenseLocalOnHeapVector(data, true).times(alpha);
+ Blas.scal(alpha, v);
+
+ Assert.assertEquals(v, exp);
+ }
+
+ /** Test 'scal' operation for sparse matrix. */
+ @Test
+ public void testScalSparse() {
+ double[] data = new double[] {1.0, 1.0};
+ double alpha = 2.0;
+
+ SparseLocalVector v = sparseFromArray(data);
+ Vector exp = sparseFromArray(data).times(alpha);
+
+ Blas.scal(alpha, v);
+
+ Assert.assertEquals(v, exp);
+ }
+
+ /** Test 'spr' operation for dense vector v and dense matrix A. */
+ @Test
+ public void testSprDenseDense() {
+ double alpha = 3.0;
+
+ DenseLocalOnHeapVector v = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ DenseLocalOnHeapVector u = new DenseLocalOnHeapVector(new double[] {3.0, 13.0, 20.0, 0.0});
+
+ // m is alpha * v * v^t
+ DenseLocalOnHeapMatrix m = (DenseLocalOnHeapMatrix)new DenseLocalOnHeapMatrix(new double[][] {{1.0, 0.0},
+ {2.0, 4.0}}, StorageConstants.COLUMN_STORAGE_MODE).times(alpha);
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{3.0, 0.0}, {13.0, 20.0}},
+ StorageConstants.COLUMN_STORAGE_MODE);
+
+ //m := alpha * v * v.t + A
+ Blas.spr(alpha, v, u);
+
+ DenseLocalOnHeapMatrix mu = fromVector(u, a.rowSize(), StorageConstants.COLUMN_STORAGE_MODE, (i, j) -> i >= j);
+ Assert.assertEquals(m.plus(a), mu);
+ }
+
+ /** Test 'spr' operation for sparse vector v (sparse in representation, dense in fact) and dense matrix A. */
+ @Test
+ public void testSprSparseDense1() {
+ double alpha = 3.0;
+
+ SparseLocalVector v = sparseFromArray(new double[] {1.0, 2.0});
+ DenseLocalOnHeapVector u = new DenseLocalOnHeapVector(new double[] {3.0, 13.0, 20.0, 0.0});
+
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{3.0, 0.0}, {13.0, 20.0}},
+ StorageConstants.COLUMN_STORAGE_MODE);
+ DenseLocalOnHeapMatrix exp = (DenseLocalOnHeapMatrix)new DenseLocalOnHeapMatrix(new double[][] {{1.0, 0.0},
+ {2.0, 4.0}}, StorageConstants.COLUMN_STORAGE_MODE).times(alpha).plus(a);
+
+ //m := alpha * v * v.t + A
+ Blas.spr(alpha, v, u);
+ DenseLocalOnHeapMatrix mu = fromVector(u, a.rowSize(), StorageConstants.COLUMN_STORAGE_MODE, (i, j) -> i >= j);
+ Assert.assertEquals(exp, mu);
+ }
+
+ /** Test 'spr' operation for sparse vector v (sparse in representation, sparse in fact) and dense matrix A. */
+ @Test
+ public void testSprSparseDense2() {
+ double alpha = 3.0;
+
+ SparseLocalVector v = new SparseLocalVector(2, StorageConstants.RANDOM_ACCESS_MODE);
+ v.set(0, 1);
+
+ DenseLocalOnHeapVector u = new DenseLocalOnHeapVector(new double[] {3.0, 13.0, 20.0, 0.0});
+
+ // m is alpha * v * v^t
+ DenseLocalOnHeapMatrix m = (DenseLocalOnHeapMatrix)new DenseLocalOnHeapMatrix(new double[][] {{1.0, 0.0},
+ {0.0, 0.0}}, StorageConstants.COLUMN_STORAGE_MODE).times(alpha);
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{3.0, 0.0}, {13.0, 20.0}},
+ StorageConstants.COLUMN_STORAGE_MODE);
+
+ //m := alpha * v * v.t + A
+ Blas.spr(alpha, v, u);
+ DenseLocalOnHeapMatrix mu = fromVector(u, a.rowSize(), StorageConstants.COLUMN_STORAGE_MODE, (i, j) -> i >= j);
+ Assert.assertEquals(m.plus(a), mu);
+ }
+
+ /** Tests 'syr' operation for dense vector x and dense matrix A. */
+ @Test
+ public void testSyrDenseDense() {
+ double alpha = 2.0;
+ DenseLocalOnHeapVector x = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{10.0, 20.0}, {20.0, 10.0}});
+
+ // alpha * x * x^T + A
+ DenseLocalOnHeapMatrix exp = (DenseLocalOnHeapMatrix)new DenseLocalOnHeapMatrix(new double[][] {{1.0, 2.0},
+ {2.0, 4.0}}).times(alpha).plus(a);
+
+ Blas.syr(alpha, x, a);
+
+ Assert.assertEquals(exp, a);
+ }
+
+ /** Tests 'gemm' operation for dense matrix A, dense matrix B and dense matrix C. */
+ @Test
+ public void testGemmDenseDenseDense() {
+ // C := alpha * A * B + beta * C
+ double alpha = 2.0;
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{10.0, 11.0}, {0.0, 1.0}});
+ DenseLocalOnHeapMatrix b = new DenseLocalOnHeapMatrix(new double[][] {{1.0, 0.0}, {0.0, 1.0}});
+ double beta = 3.0;
+ DenseLocalOnHeapMatrix c = new DenseLocalOnHeapMatrix(new double[][] {{1.0, 2.0}, {2.0, 3.0}});
+
+ DenseLocalOnHeapMatrix exp = (DenseLocalOnHeapMatrix)a.times(b).times(alpha).plus(c.times(beta));
+
+ Blas.gemm(alpha, a, b, beta, c);
+ Assert.assertEquals(exp, c);
+ }
+
+ /** Tests 'gemm' operation for sparse matrix A, dense matrix B and dense matrix C. */
+ @Test
+ public void testGemmSparseDenseDense() {
+ // C := alpha * A * B + beta * C
+ double alpha = 2.0;
+ SparseLocalOnHeapMatrix a = sparseFromArray(new double[][] {{10.0, 11.0}, {0.0, 1.0}}, 2);
+ DenseLocalOnHeapMatrix b = new DenseLocalOnHeapMatrix(new double[][] {{1.0, 0.0}, {0.0, 1.0}});
+ double beta = 3.0;
+ DenseLocalOnHeapMatrix c = new DenseLocalOnHeapMatrix(new double[][] {{1.0, 2.0}, {2.0, 3.0}});
+
+ DenseLocalOnHeapMatrix exp = MatrixUtil.asDense((SparseLocalOnHeapMatrix)a.times(b).times(alpha).plus(c.times(beta)),
+ StorageConstants.ROW_STORAGE_MODE);
+
+ Blas.gemm(alpha, a, b, beta, c);
+
+ Assert.assertEquals(exp, c);
+ }
+
+ /** Tests 'gemv' operation for dense matrix A, dense vector x and dense vector y. */
+ @Test
+ public void testGemvSparseDenseDense() {
+ // y := alpha * A * x + beta * y
+ double alpha = 3.0;
+ SparseLocalOnHeapMatrix a = sparseFromArray(new double[][] {{10.0, 11.0}, {0.0, 1.0}}, 2);
+ DenseLocalOnHeapVector x = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ double beta = 2.0;
+ DenseLocalOnHeapVector y = new DenseLocalOnHeapVector(new double[] {3.0, 4.0});
+
+ DenseLocalOnHeapVector exp = (DenseLocalOnHeapVector)y.times(beta).plus(a.times(x).times(alpha));
+
+ Blas.gemv(alpha, a, x, beta, y);
+
+ Assert.assertEquals(exp, y);
+ }
+
+ /** Tests 'gemv' operation for dense matrix A, sparse vector x and dense vector y. */
+ @Test
+ public void testGemvDenseSparseDense() {
+ // y := alpha * A * x + beta * y
+ double alpha = 3.0;
+ SparseLocalOnHeapMatrix a = sparseFromArray(new double[][] {{10.0, 11.0}, {0.0, 1.0}}, 2);
+ SparseLocalVector x = sparseFromArray(new double[] {1.0, 2.0});
+ double beta = 2.0;
+ DenseLocalOnHeapVector y = new DenseLocalOnHeapVector(new double[] {3.0, 4.0});
+
+ DenseLocalOnHeapVector exp = (DenseLocalOnHeapVector)y.times(beta).plus(a.times(x).times(alpha));
+
+ Blas.gemv(alpha, a, x, beta, y);
+
+ Assert.assertEquals(exp, y);
+ }
+
+ /** Tests 'gemv' operation for sparse matrix A, sparse vector x and dense vector y. */
+ @Test
+ public void testGemvSparseSparseDense() {
+ // y := alpha * A * x + beta * y
+ double alpha = 3.0;
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{10.0, 11.0}, {0.0, 1.0}}, 2);
+ SparseLocalVector x = sparseFromArray(new double[] {1.0, 2.0});
+ double beta = 2.0;
+ DenseLocalOnHeapVector y = new DenseLocalOnHeapVector(new double[] {3.0, 4.0});
+
+ DenseLocalOnHeapVector exp = (DenseLocalOnHeapVector)y.times(beta).plus(a.times(x).times(alpha));
+
+ Blas.gemv(alpha, a, x, beta, y);
+
+ Assert.assertEquals(exp, y);
+ }
+
+ /** Tests 'gemv' operation for dense matrix A, dense vector x and dense vector y. */
+ @Test
+ public void testGemvDenseDenseDense() {
+ // y := alpha * A * x + beta * y
+ double alpha = 3.0;
+ DenseLocalOnHeapMatrix a = new DenseLocalOnHeapMatrix(new double[][] {{10.0, 11.0}, {0.0, 1.0}}, 2);
+ DenseLocalOnHeapVector x = new DenseLocalOnHeapVector(new double[] {1.0, 2.0});
+ double beta = 2.0;
+ DenseLocalOnHeapVector y = new DenseLocalOnHeapVector(new double[] {3.0, 4.0});
+
+ DenseLocalOnHeapVector exp = (DenseLocalOnHeapVector)y.times(beta).plus(a.times(x).times(alpha));
+
+ Blas.gemv(alpha, a, x, beta, y);
+
+ Assert.assertEquals(exp, y);
+ }
+
+ /**
+ * Create a sparse vector from array.
+ *
+ * @param arr Array with vector elements.
+ * @return sparse local on-heap vector.
+ */
+ private static SparseLocalVector sparseFromArray(double[] arr) {
+ SparseLocalVector res = new SparseLocalVector(2, StorageConstants.RANDOM_ACCESS_MODE);
+
+ for (int i = 0; i < arr.length; i++)
+ res.setX(i, arr[i]);
+
+ return res;
+ }
+
+ /**
+ * Create a sparse matrix from array.
+ *
+ * @param arr Array with matrix elements.
+ * @param rows Number of rows in target matrix.
+ * @return sparse local on-heap matrix.
+ */
+ private static SparseLocalOnHeapMatrix sparseFromArray(double[][] arr, int rows) {
+ int cols = arr[0].length;
+ SparseLocalOnHeapMatrix res = new SparseLocalOnHeapMatrix(rows, cols);
+
+ for (int i = 0; i < rows; i++)
+ for (int j = 0; j < cols; j++)
+ res.set(i, j, arr[i][j]);
+
+ return res;
+ }
+
+ /**
+ * Checks if two vectors have equal elements.
+ *
+ * @param a Matrix a.
+ * @param b Vector b
+ * @return true if vectors are equal element-wise, false otherwise.
+ */
+ private static boolean elementsEqual(Vector a, Vector b) {
+ int n = b.size();
+
+ for (int i = 0; i < n; i++)
+ if (a.get(i) != b.get(i))
+ return false;
+
+ return true;
+ }
+
+ /**
+ * Creates dense local on-heap matrix from vector v entities filtered by bipredicate p.
+ *
+ * @param v Vector with entities for matrix to be created.
+ * @param rows Rows number in the target matrix.
+ * @param acsMode column or row major mode.
+ * @param p bipredicate to filter entities by.
+ * @return dense local on-heap matrix.
+ */
+ private static DenseLocalOnHeapMatrix fromVector(DenseLocalOnHeapVector v, int rows, int acsMode,
+ BiPredicate<Integer, Integer> p) {
+ double[] data = v.getStorage().data();
+ int cols = data.length / rows;
+ double[] d = new double[data.length];
+
+ int iLim = acsMode == StorageConstants.ROW_STORAGE_MODE ? rows : cols;
+ int jLim = acsMode == StorageConstants.ROW_STORAGE_MODE ? cols : rows;
+
+ int shift = 0;
+
+ for (int i = 0; i < iLim; i++)
+ for (int j = 0; j < jLim; j++) {
+ int ind = i * jLim + j;
+
+ if (!p.test(i, j)) {
+ shift++;
+ d[ind] = 0.0;
+ continue;
+ }
+ d[ind] = data[ind - shift];
+ }
+
+ return new DenseLocalOnHeapMatrix(d, rows, acsMode);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
index 4d245b4..974b7bb 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/MathImplMainTestSuite.java
@@ -27,7 +27,8 @@ import org.junit.runners.Suite;
@Suite.SuiteClasses({
MathImplLocalTestSuite.class,
MathImplDistributedTestSuite.class,
- TracerTest.class
+ TracerTest.class,
+ BlasTest.class
})
public class MathImplMainTestSuite {
// No-op.
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java
index 82564cb..3e9cdfe 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixViewConstructorTest.java
@@ -108,7 +108,7 @@ public class MatrixViewConstructorTest {
assertEquals(m.isDense(), delegateStorage.isDense());
assertEquals(m.isArrayBased(), delegateStorage.isArrayBased());
- assertArrayEquals(m.getStorage().data(), delegateStorage.data());
+ assertArrayEquals(m.getStorage().data(), delegateStorage.data(), 0.0);
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/de259fff/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java
index 569ed57..3395422 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixArrayStorageTest.java
@@ -54,10 +54,10 @@ public class MatrixArrayStorageTest extends MatrixBaseStorageTest<ArrayMatrixSto
/** */
@Test
public void data() throws Exception {
- double[][] data = storage.data();
+ double[] data = storage.data();
assertNotNull(MathTestConstants.NULL_VAL, data);
- assertTrue(MathTestConstants.UNEXPECTED_VAL, data.length == MathTestConstants.STORAGE_SIZE);
- assertTrue(MathTestConstants.UNEXPECTED_VAL, data[0].length == MathTestConstants.STORAGE_SIZE);
+ assertTrue(MathTestConstants.UNEXPECTED_VAL, data.length == MathTestConstants.STORAGE_SIZE *
+ MathTestConstants.STORAGE_SIZE);
}
}
[11/19] ignite git commit: Merge remote-tracking branch
'remotes/community/ignite-2.1.3'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/community/ignite-2.1.3'
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bd7d4077
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bd7d4077
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bd7d4077
Branch: refs/heads/ignite-5578
Commit: bd7d4077bdf0cd95618f5a8935f900f4854b5672
Parents: 3019433 2005eec
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jul 25 13:17:01 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jul 25 13:17:01 2017 +0300
----------------------------------------------------------------------
.../dht/GridClientPartitionTopology.java | 9 +-
.../dht/GridDhtPartitionTopologyImpl.java | 9 +-
.../IgniteCacheDatabaseSharedManager.java | 22 ++-
.../database/SwapPathConstructionSelfTest.java | 157 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
modules/web-console/backend/.eslintrc | 39 +++--
modules/web-console/backend/app/agentSocket.js | 4 +-
.../web-console/backend/app/browsersHandler.js | 2 +-
modules/web-console/backend/package.json | 27 ++--
modules/web-console/frontend/.eslintrc | 40 ++---
modules/web-console/frontend/app/app.js | 45 +++---
.../components/activities-user-dialog/index.js | 28 ++--
.../page-configure-advanced/controller.js | 9 +-
.../components/page-configure-basic/service.js | 8 +-
.../app/components/page-configure/controller.js | 12 +-
.../page-configure/controller.spec.js | 48 ------
.../page-configure/services/PageConfigure.js | 18 ++-
.../components/web-console-header/component.js | 12 +-
.../app/components/web-console-header/index.js | 4 +-
.../components/web-console-header/style.scss | 6 +-
.../frontend/app/decorator/select.js | 77 ---------
.../frontend/app/decorator/tooltip.js | 73 ---------
.../frontend/app/modules/ace.module.js | 6 +-
.../app/modules/branding/branding.module.js | 16 +-
.../generator/ConfigurationGenerator.js | 2 +-
.../generator/PlatformGenerator.js | 4 +-
.../frontend/app/modules/demo/Demo.module.js | 10 +-
.../app/modules/dialog/dialog.controller.js | 4 -
.../app/modules/form/field/label.directive.js | 4 +-
.../app/modules/form/field/tooltip.directive.js | 4 +-
.../frontend/app/modules/sql/sql.controller.js | 2 +-
.../frontend/app/modules/sql/sql.module.js | 66 ++++----
.../frontend/app/modules/states/admin.state.js | 6 +-
.../app/modules/states/configuration.state.js | 35 +++--
.../states/configuration/clusters/memory.pug | 8 +-
.../summary/summary-zipper.service.js | 2 +-
.../frontend/app/modules/states/errors.state.js | 4 +-
.../frontend/app/modules/states/logout.state.js | 12 +-
.../app/modules/states/password.state.js | 4 +-
.../app/modules/states/profile.state.js | 9 +-
.../frontend/app/modules/states/signin.state.js | 32 ++--
.../app/modules/user/AclRoute.provider.js | 6 +-
.../frontend/app/modules/user/user.module.js | 30 +++-
.../frontend/app/primitives/modal/index.scss | 9 ++
.../frontend/app/primitives/panel/index.scss | 2 +-
.../services/AngularStrapSelect.decorator.js | 77 +++++++++
.../services/AngularStrapTooltip.decorator.js | 103 ++++++++++++
.../app/services/CopyToClipboard.service.js | 4 +-
.../app/services/LegacyTable.service.js | 2 +-
modules/web-console/frontend/app/vendor.js | 8 +-
modules/web-console/frontend/package.json | 57 +++----
.../views/configuration/domains-import.tpl.pug | 4 +-
.../frontend/views/includes/header-left.pug | 41 ++---
modules/web-console/frontend/views/index.pug | 14 +-
.../console/agent/handlers/RestListener.java | 7 +-
.../ignite/console/agent/rest/RestExecutor.java | 49 +++---
56 files changed, 726 insertions(+), 569 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7d4077/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd7d4077/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
[07/19] ignite git commit: Web Console: Fixed UI for header menu.
Posted by sb...@apache.org.
Web Console: Fixed UI for header menu.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0d2992c5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0d2992c5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0d2992c5
Branch: refs/heads/ignite-5578
Commit: 0d2992c502d54f14b71afbc98529770f49f32345
Parents: 03f02d3
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon Jul 24 14:30:05 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon Jul 24 14:30:05 2017 +0700
----------------------------------------------------------------------
.../components/web-console-header/style.scss | 6 +--
.../states/configuration/clusters/memory.pug | 8 ++--
.../frontend/app/primitives/panel/index.scss | 2 +-
.../frontend/views/includes/header-left.pug | 41 ++++++++++----------
4 files changed, 29 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0d2992c5/modules/web-console/frontend/app/components/web-console-header/style.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-header/style.scss b/modules/web-console/frontend/app/components/web-console-header/style.scss
index 376edd9..5cc2355 100644
--- a/modules/web-console/frontend/app/components/web-console-header/style.scss
+++ b/modules/web-console/frontend/app/components/web-console-header/style.scss
@@ -18,7 +18,7 @@
web-console-header {
@import "./../../../public/stylesheets/variables.scss";
- $nav-item-margin: 42px;
+ $nav-item-margin: 40px;
$bottom-border-width: 4px;
display: block;
@@ -51,7 +51,7 @@ web-console-header {
}
&.wch-slot-left {
- margin-left: 105px;
+ margin-left: 80px;
}
&.wch-slot-right {
@@ -73,7 +73,7 @@ web-console-header {
}
.wch-nav-item,
- a.wch-nav-item {
+ .wch-nav-item > a {
cursor: pointer;
white-space: nowrap;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0d2992c5/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
index 0ba1ab4..a09fedd 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
+++ b/modules/web-console/frontend/app/modules/states/configuration/clusters/memory.pug
@@ -58,12 +58,12 @@ include /app/helpers/jade/mixins
| Memory policies configuration
.group-content
.details-row
- +text('Default region name:', model + '.defaultMemoryPolicyName', '"defaultMemoryPolicyName"',
- 'false', 'default', 'Name of the memory policy that defines the default memory region')
+ +text('Default memory policy name:', model + '.defaultMemoryPolicyName', '"defaultMemoryPolicyName"',
+ 'false', 'default', 'Name of a memory policy to be used as default one')
.details-row(ng-hide='(' + model + '.defaultMemoryPolicyName || "default") !== "default"')
- +number('Default region size:', model + '.defaultMemoryPolicySize', '"defaultMemoryPolicySize"',
+ +number('Default memory policy size:', model + '.defaultMemoryPolicySize', '"defaultMemoryPolicySize"',
'true', '0.8 * totalMemoryAvailable', '10485760',
- 'Size of the memory policy that defines the default memory region')
+ 'Specify desired size of default memory policy without having to use more verbose syntax of MemoryPolicyConfiguration elements')
.details-row(ng-init='memoryPoliciesTbl={type: "memoryPolicies", model: "memoryPolicies", focusId: "name", ui: "memory-policies-table"}')
+ignite-form-group()
ignite-form-field-label
http://git-wip-us.apache.org/repos/asf/ignite/blob/0d2992c5/modules/web-console/frontend/app/primitives/panel/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/panel/index.scss b/modules/web-console/frontend/app/primitives/panel/index.scss
index 38d18dd..56cecfe 100644
--- a/modules/web-console/frontend/app/primitives/panel/index.scss
+++ b/modules/web-console/frontend/app/primitives/panel/index.scss
@@ -31,7 +31,7 @@
padding: 22px 20px;
background-color: initial;
- border-bottom: 1px solid $panel-default-border;
+ border-bottom: 1px solid $ignite-brand-primary;
&:hover {
text-decoration: none;
http://git-wip-us.apache.org/repos/asf/ignite/blob/0d2992c5/modules/web-console/frontend/views/includes/header-left.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/includes/header-left.pug b/modules/web-console/frontend/views/includes/header-left.pug
index e9db53b..6b7fe6a 100644
--- a/modules/web-console/frontend/views/includes/header-left.pug
+++ b/modules/web-console/frontend/views/includes/header-left.pug
@@ -14,15 +14,13 @@
See the License for the specific language governing permissions and
limitations under the License.
-a.wch-nav-item(
- ui-sref='base.configuration.tabs'
- ui-sref-active='active'
-)
- | Configure
+.wch-nav-item
+ a(ui-sref='base.configuration.tabs' ui-sref-active='active')
+ | Configure
.wch-nav-item(ng-controller='notebookController')
- div(ng-if='IgniteDemoMode' ui-sref='base.sql.demo' ng-class='{active: $state.includes("base.sql")}')
- span Queries
+ a(ng-if='IgniteDemoMode' ui-sref='base.sql.demo' ui-sref-active='active')
+ | Queries
div(ng-if='!IgniteDemoMode')
div(ng-if='!notebooks.length' ng-class='{active: $state.includes("base.sql")}')
@@ -41,16 +39,19 @@ a.wch-nav-item(
span Queries
span.caret
-.wch-nav-item(ignite-navbar)
- div(ng-click='$event.stopPropagation()'
- ng-class='{active: $state.includes("base.monitoring")}'
- ng-repeat='item in navbar.items'
- bs-dropdown='item.children'
- data-placement='bottom-left'
- data-trigger='hover focus'
- data-container='self'
- aria-haspopup='true'
- aria-expanded='false'
- )
- span {{::item.text}}
- span.caret
+.wch-content(ignite-navbar)
+ .wch-nav-item(ng-repeat='item in navbar.items')
+ div(ng-if='item.children' ng-click='$event.stopPropagation()'
+ ng-class='{active: $state.includes(item.sref)}'
+ bs-dropdown='item.children'
+ data-placement='bottom-left'
+ data-trigger='hover focus'
+ data-container='self'
+ aria-haspopup='true'
+ aria-expanded='false'
+ )
+ span {{::item.text}}
+ span.caret
+
+ a(ng-if='!item.children' ui-sref='{{item.sref}}' ui-sref-active='active')
+ | {{::item.text}}
\ No newline at end of file
[10/19] ignite git commit: IGNITE-5820 Web Console: Adjust modals
height.
Posted by sb...@apache.org.
IGNITE-5820 Web Console: Adjust modals height.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2005eec0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2005eec0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2005eec0
Branch: refs/heads/ignite-5578
Commit: 2005eec081add6906fa204c4db0cfcc4a4907292
Parents: f277530
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Jul 25 15:49:21 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Jul 25 15:49:21 2017 +0700
----------------------------------------------------------------------
.../web-console/frontend/app/primitives/modal/index.scss | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2005eec0/modules/web-console/frontend/app/primitives/modal/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/modal/index.scss b/modules/web-console/frontend/app/primitives/modal/index.scss
index 87d8dc3..fcf9885 100644
--- a/modules/web-console/frontend/app/primitives/modal/index.scss
+++ b/modules/web-console/frontend/app/primitives/modal/index.scss
@@ -57,6 +57,15 @@
transform: translateZ(1px);
}
+.modal .modal-dialog--adjust-height {
+ margin-top: 0;
+ margin-bottom: 0;
+
+ .modal-body {
+ max-height: calc(100vh - 150px);
+ }
+}
+
.modal .modal-content {
background-color: $gray-lighter;
[15/19] ignite git commit: IGNITE-5802: Fix all wrong TODO comments
in ML component
Posted by sb...@apache.org.
IGNITE-5802: Fix all wrong TODO comments in ML component
This closes #2340
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/13184720
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/13184720
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/13184720
Branch: refs/heads/ignite-5578
Commit: 131847203d55f4f3907a7ff62d53ff69345fa605
Parents: bdc9e4b
Author: Yury Babak <yb...@gridgain.com>
Authored: Tue Jul 25 15:22:34 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Jul 25 15:22:34 2017 +0300
----------------------------------------------------------------------
.../ml/clustering/KMeansDistributedClusterer.java | 6 +++---
.../ignite/ml/clustering/KMeansLocalClusterer.java | 2 +-
.../main/java/org/apache/ignite/ml/math/MathUtils.java | 1 +
.../java/org/apache/ignite/ml/math/VectorUtils.java | 7 +++++--
.../ignite/ml/math/decompositions/LUDecomposition.java | 2 +-
.../ignite/ml/math/decompositions/QRDecomposition.java | 2 +-
.../ml/math/exceptions/MathIllegalNumberException.java | 8 ++++----
.../org/apache/ignite/ml/math/impls/CacheUtils.java | 4 ++--
.../ignite/ml/math/impls/matrix/AbstractMatrix.java | 2 --
.../impls/storage/matrix/DenseOffHeapMatrixStorage.java | 2 +-
.../storage/vector/DenseLocalOffHeapVectorStorage.java | 2 +-
.../storage/vector/SparseLocalOffHeapVectorStorage.java | 2 +-
.../storage/vector/SparseLocalOnHeapVectorStorage.java | 4 ++--
.../apache/ignite/ml/math/impls/vector/CacheVector.java | 4 ++--
.../ignite/ml/math/impls/vector/MapWrapperVector.java | 1 -
.../ignite/ml/math/impls/vector/SparseLocalVector.java | 6 +++---
.../apache/ignite/ml/math/impls/vector/VectorView.java | 2 +-
.../java/org/apache/ignite/ml/math/util/MatrixUtil.java | 4 ++--
.../regressions/AbstractMultipleLinearRegression.java | 4 ++--
.../ml/regressions/OLSMultipleLinearRegression.java | 2 +-
.../src/test/java/org/apache/ignite/ml/TestUtils.java | 2 +-
.../apache/ignite/ml/math/benchmark/MathBenchmark.java | 2 +-
.../ignite/ml/math/benchmark/VectorBenchmarkTest.java | 2 +-
.../ml/math/decompositions/EigenDecompositionTest.java | 2 +-
.../ml/math/impls/matrix/MatrixAttributeTest.java | 2 --
.../storage/matrix/MatrixStorageImplementationTest.java | 2 +-
.../ignite/ml/math/impls/vector/AbstractVectorTest.java | 4 ++--
.../impls/vector/PivotedVectorViewConstructorTest.java | 2 +-
.../ml/math/impls/vector/VectorAttributesTest.java | 2 +-
.../ignite/ml/math/impls/vector/VectorFoldMapTest.java | 2 +-
.../ml/math/impls/vector/VectorImplementationsTest.java | 12 ++++++------
.../ignite/ml/math/impls/vector/VectorIterableTest.java | 2 +-
.../ignite/ml/math/impls/vector/VectorToMatrixTest.java | 4 ++--
.../ml/regressions/OLSMultipleLinearRegressionTest.java | 4 ++--
34 files changed, 55 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansDistributedClusterer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansDistributedClusterer.java b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansDistributedClusterer.java
index 5f702d2..2ef61ad 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansDistributedClusterer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansDistributedClusterer.java
@@ -80,7 +80,7 @@ public class KMeansDistributedClusterer extends BaseKMeansClusterer<SparseDistri
MathIllegalArgumentException, ConvergenceException {
SparseDistributedMatrix pointsCp = (SparseDistributedMatrix)points.like(points.rowSize(), points.columnSize());
- // TODO: this copy is very ineffective, just for POC. Immutability of data should be guaranteed by other methods
+ // TODO: IGNITE-5825, this copy is very ineffective, just for POC. Immutability of data should be guaranteed by other methods
// such as logical locks for example.
pointsCp.assign(points);
@@ -117,10 +117,10 @@ public class KMeansDistributedClusterer extends BaseKMeansClusterer<SparseDistri
/** Initialize cluster centers. */
private Vector[] initClusterCenters(SparseDistributedMatrix points, int k) {
// Initialize empty centers and point costs.
- int ptsCount = points.rowSize();
+ int ptsCnt = points.rowSize();
// Initialize the first center to a random point.
- Vector sample = localCopyOf(points.viewRow(rnd.nextInt(ptsCount)));
+ Vector sample = localCopyOf(points.viewRow(rnd.nextInt(ptsCnt)));
List<Vector> centers = new ArrayList<>();
List<Vector> newCenters = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansLocalClusterer.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansLocalClusterer.java b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansLocalClusterer.java
index 9f2aefb..3d005b4 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansLocalClusterer.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/clustering/KMeansLocalClusterer.java
@@ -92,7 +92,7 @@ public class KMeansLocalClusterer extends BaseKMeansClusterer<DenseLocalOnHeapMa
}
if (j == 0)
- // TODO: Process this case more carefully
+ // TODO: IGNITE-5825, Process this case more carefully
centers[i] = localCopyOf(points.viewRow(0));
else
centers[i] = localCopyOf(points.viewRow(j - 1));
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/MathUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/MathUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/MathUtils.java
index c2164ab..c7b33c3 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/MathUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/MathUtils.java
@@ -23,6 +23,7 @@ import org.apache.ignite.ml.math.exceptions.NullArgumentException;
* Miscellaneous utility functions.
*/
public final class MathUtils {
+ /** */
public static void checkNotNull(Object o)
throws NullArgumentException {
if (o == null)
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java
index 061d5ae..6bb0276 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/VectorUtils.java
@@ -21,6 +21,9 @@ import java.util.Map;
import org.apache.ignite.ml.math.impls.vector.DenseLocalOnHeapVector;
import org.apache.ignite.ml.math.impls.vector.MapWrapperVector;
+/**
+ * Some utils for {@link Vector}.
+ */
public class VectorUtils {
/** Create new vector like given vector initialized by zeroes. */
public static Vector zeroesLike(Vector v) {
@@ -33,7 +36,7 @@ public class VectorUtils {
}
/** */
- public static Vector fromMap(Map<Integer, Double> value, boolean copy) {
- return new MapWrapperVector(value);
+ public static Vector fromMap(Map<Integer, Double> val, boolean cp) {
+ return new MapWrapperVector(val);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
index 4c388b3..df7b6cd 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/LUDecomposition.java
@@ -35,7 +35,7 @@ import static org.apache.ignite.ml.math.util.MatrixUtil.likeVector;
* @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
* @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
*
- * TODO: Maybe we should make this class (and other decompositions) Externalizable.
+ * TODO: IGNITE-5828, Maybe we should make this class (and other decompositions) Externalizable.
*/
public class LUDecomposition implements Destroyable {
/** Default bound to determine effective singularity in LU decomposition. */
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
index 5ffa574..3d0bb5d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/decompositions/QRDecomposition.java
@@ -227,7 +227,7 @@ public class QRDecomposition implements Destroyable {
* @throws SingularMatrixException if the matrix is singular and {@code raise} is {@code true}.
*/
private static boolean checkSingular(Matrix r, double min, boolean raise) {
- // TODO: Not a very fast approach for distributed matrices. would be nice if we could independently check
+ // TODO: IGNITE-5828, Not a very fast approach for distributed matrices. would be nice if we could independently check
// parts on different nodes for singularity and do fold with 'or'.
final int len = r.columnSize();
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalNumberException.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalNumberException.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalNumberException.java
index 2e7280b..b2abf63 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalNumberException.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/exceptions/MathIllegalNumberException.java
@@ -28,7 +28,7 @@ public class MathIllegalNumberException extends MathIllegalArgumentException {
private static final long serialVersionUID = -7447085893598031110L;
/** Requested. */
- private final Number argument;
+ private final Number arg;
/**
* Construct an exception.
@@ -39,13 +39,13 @@ public class MathIllegalNumberException extends MathIllegalArgumentException {
*/
protected MathIllegalNumberException(String msg, Number wrong, Object... arguments) {
super(msg, wrong, arguments);
- argument = wrong;
+ arg = wrong;
}
/**
* @return the requested value.
*/
- public Number getArgument() {
- return argument;
+ public Number getArg() {
+ return arg;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
index 369840b..2c519f0 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/CacheUtils.java
@@ -30,6 +30,7 @@ import org.apache.ignite.cache.query.ScanQuery;
import org.apache.ignite.cluster.ClusterGroup;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
+import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.lang.IgnitePredicate;
@@ -43,12 +44,11 @@ import org.apache.ignite.ml.math.functions.IgniteDoubleFunction;
import org.apache.ignite.ml.math.functions.IgniteFunction;
import org.apache.ignite.ml.math.impls.matrix.BlockEntry;
import org.apache.ignite.ml.math.impls.storage.matrix.BlockMatrixKey;
-import org.apache.ignite.internal.util.typedef.internal.A;
/**
* Distribution-related misc. support.
*
- * TODO: IGNITE-5102, fix sparse key filters
+ * TODO: IGNITE-5102, fix sparse key filters.
*/
public class CacheUtils {
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
index 3dc9b43..647ebc6 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/matrix/AbstractMatrix.java
@@ -44,8 +44,6 @@ import org.apache.ignite.ml.math.impls.vector.MatrixVectorView;
* interface to minimize the effort required to implement it.
* Subclasses may override some of the implemented methods if a more
* specific or optimized implementation is desirable.
- *
- * TODO: add row/column optimization.
*/
public abstract class AbstractMatrix implements Matrix {
// Stochastic sparsity analysis.
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
index 62060d1..7405a4e 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/matrix/DenseOffHeapMatrixStorage.java
@@ -33,7 +33,7 @@ public class DenseOffHeapMatrixStorage implements MatrixStorage {
private int cols;
/** */
private transient long ptr;
- //TODO: temp solution.
+ //TODO: IGNITE-5535, temp solution.
/** */
private int ptrInitHash;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
index a9965cc..71b7793 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/DenseLocalOffHeapVectorStorage.java
@@ -33,7 +33,7 @@ public class DenseLocalOffHeapVectorStorage implements VectorStorage {
/** */
private transient long ptr;
- //TODO: temp solution.
+ //TODO: IGNITE-5535, temp solution.
/** */
private int ptrInitHash;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
index f6148c8..a858364 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOffHeapVectorStorage.java
@@ -76,7 +76,7 @@ public class SparseLocalOffHeapVectorStorage implements VectorStorage {
/** {@inheritDoc} */
@Override public void writeExternal(ObjectOutput out) throws IOException {
- throw new UnsupportedOperationException(); // TODO: add externalization support.
+ throw new UnsupportedOperationException(); // TODO: IGNITE-5801, add externalization support.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
index 5145376..deef010 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/storage/vector/SparseLocalOnHeapVectorStorage.java
@@ -47,7 +47,7 @@ public class SparseLocalOnHeapVectorStorage implements VectorStorage, StorageCon
}
/** */
- public SparseLocalOnHeapVectorStorage(Map<Integer, Double> map, boolean copy) {
+ public SparseLocalOnHeapVectorStorage(Map<Integer, Double> map, boolean cp) {
assert map.size() > 0;
this.size = map.size();
@@ -59,7 +59,7 @@ public class SparseLocalOnHeapVectorStorage implements VectorStorage, StorageCon
else
acsMode = UNKNOWN_STORAGE_MODE;
- if (copy)
+ if (cp)
switch (acsMode) {
case SEQUENTIAL_ACCESS_MODE:
sto = new Int2DoubleRBTreeMap(map);
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/CacheVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/CacheVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/CacheVector.java
index f78113c..fec230f 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/CacheVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/CacheVector.java
@@ -88,8 +88,8 @@ public class CacheVector<K, V> extends AbstractVector {
/** {@inheritDoc} */
@Override public Vector map(IgniteBiFunction<Double, Double, Double> fun, double y) {
- // TODO: provide cache-optimized implementation.
- return super.map(fun, y); // TODO
+ // TODO: IGNTIE-5723, provide cache-optimized implementation.
+ return super.map(fun, y);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java
index a093d0e..83b40c1 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/MapWrapperVector.java
@@ -26,7 +26,6 @@ import org.apache.ignite.ml.math.impls.storage.matrix.MapWrapperStorage;
* Vector wrapping a given map.
*/
public class MapWrapperVector extends AbstractVector {
-
/**
* Construct a vector wrapping given map.
*
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
index be5d0f6..9e345bb 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseLocalVector.java
@@ -37,10 +37,10 @@ public class SparseLocalVector extends AbstractVector implements StorageConstant
/**
* @param map Underlying map.
- * @param copy Should given map be copied.
+ * @param cp Should given map be copied.
*/
- public SparseLocalVector(Map<Integer, Double> map, boolean copy) {
- setStorage(new SparseLocalOnHeapVectorStorage(map, copy));
+ public SparseLocalVector(Map<Integer, Double> map, boolean cp) {
+ setStorage(new SparseLocalOnHeapVectorStorage(map, cp));
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java
index 0988059..071c6ed 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/VectorView.java
@@ -60,7 +60,7 @@ public class VectorView extends AbstractVector {
/** {@inheritDoc} */
@Override public Vector copy() {
- // TODO: revise this
+ // TODO: IGNTIE-5723, revise this
DelegateVectorStorage sto = storage();
return new VectorView(sto.delegate(), sto.offset(), sto.length());
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
index 7a90ba1..752929d 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/math/util/MatrixUtil.java
@@ -53,7 +53,7 @@ public class MatrixUtil {
*/
public static Matrix identityLike(Matrix matrix, int n) {
Matrix res = like(matrix, n, n);
- // TODO: Maybe we should introduce API for walking(and changing) matrix in
+ // TODO: IGNITE-5216, Maybe we should introduce API for walking(and changing) matrix in.
// a fastest possible visiting order.
for (int i = 0; i < n; i++)
res.setX(i, i, 1.0);
@@ -143,7 +143,7 @@ public class MatrixUtil {
return res;
}
- /** TODO: rewrite in a more optimal way. */
+ /** TODO: IGNTIE-5723, rewrite in a more optimal way. */
public static DenseLocalOnHeapVector localCopyOf(Vector vec) {
DenseLocalOnHeapVector res = new DenseLocalOnHeapVector(vec.size());
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
index d558dc0..a2a8f16 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/AbstractMultipleLinearRegression.java
@@ -138,7 +138,7 @@ public abstract class AbstractMultipleLinearRegression implements MultipleLinear
throw new NullArgumentException();
if (y.size() == 0)
throw new NoDataException();
- // TODO: Should we copy here?
+ // TODO: IGNITE-5826, Should we copy here?
yVector = y;
}
@@ -174,7 +174,7 @@ public abstract class AbstractMultipleLinearRegression implements MultipleLinear
if (x.rowSize() == 0)
throw new NoDataException();
if (noIntercept)
- // TODO: Should we copy here?
+ // TODO: IGNITE-5826, Should we copy here?
xMatrix = x;
else { // Augment design matrix with initial unitary column
xMatrix = MatrixUtil.like(x, x.rowSize(), x.columnSize() + 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
index c53a77e..36d5f2c 100644
--- a/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
+++ b/modules/ml/src/main/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegression.java
@@ -155,7 +155,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
if (isNoIntercept())
return getY().foldMap(Functions.PLUS, Functions.SQUARE, 0.0);
else {
- // TODO: think about incremental update formula.
+ // TODO: IGNITE-5826, think about incremental update formula.
final double mean = getY().sum() / getY().size();
return getY().foldMap(Functions.PLUS, x -> (mean - x) * (mean - x), 0.0);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
index 9c3b4c9..62fdf2c 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/TestUtils.java
@@ -160,7 +160,7 @@ public class TestUtils {
double eij = exp.getX(i, j);
double aij = actual.getX(i, j);
- // TODO: Check precision here.
+ // TODO: IGNITE-5824, Check precision here.
Assert.assertEquals(eij, aij, 0.0);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java
index 33ccfc9..69737f7 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/MathBenchmark.java
@@ -197,7 +197,7 @@ class MathBenchmark {
/** */
interface BenchmarkCode {
- // todo find out why Callable<Void> failed to work here
+ //TODO: IGNITE-5827, find out why Callable<Void> failed to work here
/** */
void call() throws Exception;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java
index fd98382..98a93d9 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/benchmark/VectorBenchmarkTest.java
@@ -30,7 +30,7 @@ import static org.junit.Assert.assertNotNull;
/** */
public class VectorBenchmarkTest {
- // todo add benchmarks for other methods in Vector and for other types of Vector and Matrix
+ //TODO: IGNITE-5827, add benchmarks for other methods in Vector and for other types of Vector and Matrix
/** */
@Test
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/EigenDecompositionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/EigenDecompositionTest.java
index d283ce7..76aca0b 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/EigenDecompositionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/decompositions/EigenDecompositionTest.java
@@ -78,7 +78,7 @@ public class EigenDecompositionTest {
{0.0d, 1.0d, 0.0d},
{0.0d, 0.0d, 2.0d},
{1.0d, 1.0d, 0.0d}}));
- // todo find out why decomposition of 3X4 matrix throws row index exception
+ // TODO: IGNITE-5828, find out why decomposition of 3X4 matrix throws row index exception
Matrix d = decomposition.getD();
Matrix v = decomposition.getV();
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java
index 79cb13a..c645bd7 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/matrix/MatrixAttributeTest.java
@@ -27,8 +27,6 @@ import static org.junit.Assert.assertEquals;
/**
* Attribute tests for matrices.
- *
- * TODO: WIP
*/
public class MatrixAttributeTest {
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java
index 72daeca..7f1b6b3 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/storage/matrix/MatrixStorageImplementationTest.java
@@ -28,7 +28,7 @@ import static org.junit.Assert.assertTrue;
/**
* Unit tests for {@link MatrixStorage} implementations.
*
- * TODO: add attribute tests.
+ * TODO: IGNITE-5723, add attribute tests.
*/
public class MatrixStorageImplementationTest extends ExternalizeTest<MatrixStorage> {
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java
index a7954cd..be7532f 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/AbstractVectorTest.java
@@ -357,7 +357,7 @@ public class AbstractVectorTest {
*/
@SuppressWarnings("ClassWithoutNoArgConstructor")
private AbstractVector getAbstractVector(VectorStorage storage) {
- return new AbstractVector(storage) { // TODO: find out how to fix warning about missing constructor
+ return new AbstractVector(storage) { // TODO: IGNTIE-5723, find out how to fix warning about missing constructor
/** {@inheritDoc} */
@Override public boolean isDense() {
return false;
@@ -426,7 +426,7 @@ public class AbstractVectorTest {
* @return AbstractVector.
*/
private AbstractVector getAbstractVector() {
- return new AbstractVector() { // TODO: find out how to fix warning about missing constructor
+ return new AbstractVector() { // TODO: IGNTIE-5723, find out how to fix warning about missing constructor
/** {@inheritDoc} */
@Override public boolean isDense() {
return false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/PivotedVectorViewConstructorTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/PivotedVectorViewConstructorTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/PivotedVectorViewConstructorTest.java
index 72be324..f07a3fd 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/PivotedVectorViewConstructorTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/PivotedVectorViewConstructorTest.java
@@ -177,7 +177,7 @@ public class PivotedVectorViewConstructorTest {
}
/** */
- private static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+ private static class Metric { // TODO: IGNITE-5824, consider if softer tolerance (like say 0.1 or 0.01) would make sense here
/** */
private final double exp;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java
index e2f6a40..52232ca 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorAttributesTest.java
@@ -75,7 +75,7 @@ public class VectorAttributesTest {
"isRandomAccess", "isDistributed"),
new Specification(new MatrixVectorView(new DenseLocalOnHeapMatrix(1, 1), 0, 0, 1, 1),
DenseLocalOnHeapVector.class, "isDense",
- "isRandomAccess", "isDistributed"), // todo find out why "isSequentialAccess" fails here
+ "isRandomAccess", "isDistributed"), // TODO: IGNTIE-5723, find out why "isSequentialAccess" fails here
new Specification(new MatrixVectorView(new DenseLocalOffHeapMatrix(1, 1), 0, 0, 1, 1),
DenseLocalOffHeapVector.class, "isDense",
"isRandomAccess", "isDistributed"));
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java
index 676bb17..d18dff2 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorFoldMapTest.java
@@ -101,7 +101,7 @@ public class VectorFoldMapTest {
private void operationVectorTest(BiFunction<Double, Double, Double> operation,
BiFunction<Vector, Vector, Vector> vecOperation) {
consumeSampleVectors((v, desc) -> {
- // TODO find out if more elaborate testing scenario is needed or it's okay as is.
+ // TODO: IGNTIE-5723, find out if more elaborate testing scenario is needed or it's okay as is.
final int size = v.size();
final double[] ref = new double[size];
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java
index 48dcc36..8075b29 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorImplementationsTest.java
@@ -39,7 +39,7 @@ import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/** See also: {@link AbstractVectorTest} and {@link VectorToMatrixTest}. */
-public class VectorImplementationsTest { // todo split this to smaller cohesive test classes
+public class VectorImplementationsTest { // TODO: IGNTIE-5723, split this to smaller cohesive test classes
/** */
@Test
public void vectorImplementationsFixturesTest() {
@@ -95,7 +95,7 @@ public class VectorImplementationsTest { // todo split this to smaller cohesive
public void operateXOutOfBoundsTest() {
consumeSampleVectors((v, desc) -> {
if (v instanceof DenseLocalOffHeapVector || v instanceof SparseLocalVector || v instanceof SparseLocalOffHeapVector)
- return; // todo find out if it's OK to skip by instances here
+ return; // TODO: IGNTIE-5723, find out if it's OK to skip by instances here
boolean expECaught = false;
@@ -485,7 +485,7 @@ public class VectorImplementationsTest { // todo split this to smaller cohesive
@Override public void externalizeTest() {
consumeSampleVectors((v, desc) -> {
if (v instanceof SparseLocalOffHeapVector)
- return; //TODO: wait till SparseLocalOffHeapVector externalization support.
+ return; //TODO: IGNITE-5801, wait till SparseLocalOffHeapVector externalization support.
externalizeTest(v);
});
@@ -501,7 +501,7 @@ public class VectorImplementationsTest { // todo split this to smaller cohesive
/** */
private boolean getXOutOfBoundsOK(Vector v) {
- // todo find out if this is indeed OK
+ // TODO: IGNTIE-5723, find out if this is indeed OK
return v instanceof RandomVector || v instanceof ConstantVector
|| v instanceof SingleElementVector || v instanceof SingleElementVectorView;
}
@@ -569,7 +569,7 @@ public class VectorImplementationsTest { // todo split this to smaller cohesive
private void operationVectorTest(BiFunction<Double, Double, Double> operation,
BiFunction<Vector, Vector, Vector> vecOperation) {
consumeSampleVectors((v, desc) -> {
- // TODO find out if more elaborate testing scenario is needed or it's okay as is.
+ // TODO : IGNTIE-5723, find out if more elaborate testing scenario is needed or it's okay as is.
final int size = v.size();
final double[] ref = new double[size];
@@ -827,7 +827,7 @@ public class VectorImplementationsTest { // todo split this to smaller cohesive
}
/** */
- static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+ static class Metric { //TODO: IGNITE-5824, consider if softer tolerance (like say 0.1 or 0.01) would make sense here
/** */
private final double exp;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorIterableTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorIterableTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorIterableTest.java
index 16c2571..6400c80 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorIterableTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorIterableTest.java
@@ -148,7 +148,7 @@ public class VectorIterableTest {
/** */
@Test
public void nonZeroesTest() {
- // todo make RandomVector constructor that accepts a function and use it here
+ // TODO: IGNTIE-5723, make RandomVector constructor that accepts a function and use it here.
// in order to *reliably* test non-zeroes in there
consumeSampleVectors(
(v, desc) -> consumeSampleVectorsWithZeroes(v, (vec, numZeroes)
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java
index 4d5bc56..a003dcf 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/math/impls/vector/VectorToMatrixTest.java
@@ -268,7 +268,7 @@ public class VectorToMatrixTest {
put(DenseLocalOffHeapVector.class, DenseLocalOffHeapMatrix.class);
put(RandomVector.class, RandomMatrix.class);
put(SparseLocalVector.class, SparseLocalOnHeapMatrix.class);
- put(SingleElementVector.class, null); // todo find out if we need SingleElementMatrix to match, or skip it
+ put(SingleElementVector.class, null); // TODO: IGNTIE-5723, find out if we need SingleElementMatrix to match, or skip it.
put(ConstantVector.class, null);
put(FunctionVector.class, null);
put(PivotedVectorView.class, DenseLocalOnHeapMatrix.class); // IMPL NOTE per fixture
@@ -280,7 +280,7 @@ public class VectorToMatrixTest {
}
/** */
- private static class Metric { // todo consider if softer tolerance (like say 0.1 or 0.01) would make sense here
+ private static class Metric { //TODO: IGNITE-5824, consider if softer tolerance (like say 0.1 or 0.01) would make sense here.
/** */
private final double exp;
http://git-wip-us.apache.org/repos/asf/ignite/blob/13184720/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
index 7f76750..c0069b5 100644
--- a/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
+++ b/modules/ml/src/test/java/org/apache/ignite/ml/regressions/OLSMultipleLinearRegressionTest.java
@@ -186,7 +186,7 @@ public class OLSMultipleLinearRegressionTest extends AbstractMultipleLinearRegre
Assert.assertEquals(0.995479004577296, mdl.calculateRSquared(), 1E-12);
Assert.assertEquals(0.992465007628826, mdl.calculateAdjustedRSquared(), 1E-12);
- // TODO: uncomment
+ // TODO: IGNITE-5826, uncomment.
// checkVarianceConsistency(model);
// Estimate model without intercept
@@ -336,7 +336,7 @@ public class OLSMultipleLinearRegressionTest extends AbstractMultipleLinearRegre
Assert.assertEquals(0.649789742860228, mdl.calculateRSquared(), 1E-12);
Assert.assertEquals(0.6164363850373927, mdl.calculateAdjustedRSquared(), 1E-12);
- // TODO: uncomment
+ // TODO: IGNITE-5826, uncomment.
// checkVarianceConsistency(model);
// Estimate the model with no intercept
[05/19] ignite git commit: IGNITE-5754 Web Console agent: Use POST
instead of GET for requests.
Posted by sb...@apache.org.
IGNITE-5754 Web Console agent: Use POST instead of GET for requests.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/abc6e46f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/abc6e46f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/abc6e46f
Branch: refs/heads/ignite-5578
Commit: abc6e46fb9ec1c5ee228c01943c516ba0f602456
Parents: 95f4abc
Author: Andrey Novikov <an...@gridgain.com>
Authored: Mon Jul 24 10:54:01 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Mon Jul 24 10:54:01 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/app/agentSocket.js | 4 +-
.../web-console/backend/app/browsersHandler.js | 2 +-
.../console/agent/handlers/RestListener.java | 7 +--
.../ignite/console/agent/rest/RestExecutor.java | 49 +++++++-------------
4 files changed, 22 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/abc6e46f/modules/web-console/backend/app/agentSocket.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/agentSocket.js b/modules/web-console/backend/app/agentSocket.js
index db1deaa..0853339 100644
--- a/modules/web-console/backend/app/agentSocket.js
+++ b/modules/web-console/backend/app/agentSocket.js
@@ -126,7 +126,7 @@ module.exports.factory = function(_) {
* Send event to agent.
*
* @param {String} event - Event name.
- * @param {Array.<Object>?} args - Transmitted arguments.
+ * @param {Object?} args - Transmitted arguments.
* @returns {Promise}
*/
emitEvent(event, ...args) {
@@ -202,7 +202,7 @@ module.exports.factory = function(_) {
params[`p${idx + 1}`] = args[idx];
});
- return this.emitEvent('node:rest', {uri: 'ignite', demo, params, method: 'GET'})
+ return this.emitEvent('node:rest', {uri: 'ignite', demo, params})
.then(this.restResultParse);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/abc6e46f/modules/web-console/backend/app/browsersHandler.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/browsersHandler.js b/modules/web-console/backend/app/browsersHandler.js
index c4ea532..4fb5088 100644
--- a/modules/web-console/backend/app/browsersHandler.js
+++ b/modules/web-console/backend/app/browsersHandler.js
@@ -179,7 +179,7 @@ module.exports.factory = (_, socketio, configure, errors, mongo) => {
*/
executeOnNode(agent, demo, params) {
return agent
- .then((agentSock) => agentSock.emitEvent('node:rest', {uri: 'ignite', demo, params, method: 'GET'}))
+ .then((agentSock) => agentSock.emitEvent('node:rest', {uri: 'ignite', demo, params}))
.then((res) => {
if (res.status === 0)
return JSON.parse(res.data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/abc6e46f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
index c70514d..8855060 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/handlers/RestListener.java
@@ -61,11 +61,6 @@ public class RestListener extends AbstractListener {
boolean demo = (boolean)args.get("demo");
- if (!args.containsKey("method"))
- throw new IllegalArgumentException("Missing method in arguments: " + args);
-
- String mtd = args.get("method").toString();
-
Map<String, Object> headers = null;
if (args.containsKey("headers"))
@@ -76,6 +71,6 @@ public class RestListener extends AbstractListener {
if (args.containsKey("body"))
body = args.get("body").toString();
- return restExecutor.execute(demo, path, params, mtd, headers, body);
+ return restExecutor.execute(demo, path, params, headers, body);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/abc6e46f/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
index 3936374..03eca4e 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/rest/RestExecutor.java
@@ -90,7 +90,7 @@ public class RestExecutor {
/** */
private RestResult sendRequest(boolean demo, String path, Map<String, Object> params,
- String mtd, Map<String, Object> headers, String body) throws IOException {
+ Map<String, Object> headers, String body) throws IOException {
if (demo && AgentClusterDemo.getDemoUrl() == null) {
try {
AgentClusterDemo.tryStart().await();
@@ -120,36 +120,24 @@ public class RestExecutor {
reqBuilder.addHeader(entry.getKey(), entry.getValue().toString());
}
- if ("GET".equalsIgnoreCase(mtd)) {
+ if (body != null) {
+ MediaType contentType = MediaType.parse("text/plain");
+
+ reqBuilder.post(RequestBody.create(contentType, body));
+ }
+ else {
+ FormBody.Builder formBody = new FormBody.Builder();
+
if (params != null) {
for (Map.Entry<String, Object> entry : params.entrySet()) {
if (entry.getValue() != null)
- urlBuilder.addQueryParameter(entry.getKey(), entry.getValue().toString());
+ formBody.add(entry.getKey(), entry.getValue().toString());
}
}
- }
- else if ("POST".equalsIgnoreCase(mtd)) {
- if (body != null) {
- MediaType contentType = MediaType.parse("text/plain");
-
- reqBuilder.post(RequestBody.create(contentType, body));
- }
- else {
- FormBody.Builder formBody = new FormBody.Builder();
-
- if (params != null) {
- for (Map.Entry<String, Object> entry : params.entrySet()) {
- if (entry.getValue() != null)
- formBody.add(entry.getKey(), entry.getValue().toString());
- }
- }
- reqBuilder.post(formBody.build());
- }
+ reqBuilder.post(formBody.build());
}
- else
- throw new IllegalArgumentException("Unknown HTTP-method: " + mtd);
-
+
reqBuilder.url(urlBuilder.build());
try (Response resp = httpClient.newCall(reqBuilder.build()).execute()) {
@@ -180,7 +168,7 @@ public class RestExecutor {
"Please ensure that nodes have [ignite-rest-http] module in classpath " +
"(was copied from libs/optional to libs folder).");
- throw new ConnectException("Failed connect to node and execute REST command [url=" + urlBuilder + "]");
+ throw new ConnectException("Failed connect to node and execute REST command [url=" + urlBuilder + ", parameters=" + params + "]");
}
}
@@ -188,21 +176,20 @@ public class RestExecutor {
* @param demo Is demo node request.
* @param path Path segment.
* @param params Params.
- * @param mtd Method.
* @param headers Headers.
* @param body Body.
*/
public RestResult execute(boolean demo, String path, Map<String, Object> params,
- String mtd, Map<String, Object> headers, String body) {
+ Map<String, Object> headers, String body) {
if (log.isDebugEnabled())
- log.debug("Start execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
+ log.debug("Start execute REST command [uri=/" + (path == null ? "" : path) +
", parameters=" + params + "]");
try {
- return sendRequest(demo, path, params, mtd, headers, body);
+ return sendRequest(demo, path, params, headers, body);
}
catch (Exception e) {
- U.error(log, "Failed to execute REST command [method=" + mtd + ", uri=/" + (path == null ? "" : path) +
+ U.error(log, "Failed to execute REST command [uri=/" + (path == null ? "" : path) +
", parameters=" + params + "]", e);
return RestResult.fail(404, e.getMessage());
@@ -219,6 +206,6 @@ public class RestExecutor {
params.put("attr", true);
params.put("mtr", full);
- return sendRequest(demo, "ignite", params, "GET", null, null);
+ return sendRequest(demo, "ignite", params, null, null);
}
}
[14/19] ignite git commit: IGNITE-5770 Refactor PlatformProcessor to
PlatformTarget mechanism
Posted by sb...@apache.org.
IGNITE-5770 Refactor PlatformProcessor to PlatformTarget mechanism
This closes #2336
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bdc9e4b9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bdc9e4b9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bdc9e4b9
Branch: refs/heads/ignite-5578
Commit: bdc9e4b91403595c496a5fa4aca70228665feaaa
Parents: bd7d407
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Jul 25 15:15:43 2017 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Jul 25 15:15:43 2017 +0300
----------------------------------------------------------------------
.../platform/PlatformAbstractTarget.java | 6 +-
.../processors/platform/PlatformIgnition.java | 5 +-
.../platform/PlatformNoopProcessor.java | 132 -----
.../processors/platform/PlatformProcessor.java | 216 --------
.../platform/PlatformProcessorImpl.java | 554 +++++++++++--------
.../platform/cluster/PlatformClusterGroup.java | 29 +
.../datastructures/PlatformAtomicReference.java | 13 +-
.../platforms/cpp/core/include/ignite/ignite.h | 6 +-
.../include/ignite/impl/compute/compute_impl.h | 5 +-
.../cpp/core/include/ignite/impl/ignite_impl.h | 112 ++--
.../ignite/impl/interop/interop_target.h | 16 +-
modules/platforms/cpp/core/src/ignition.cpp | 23 +-
.../cpp/core/src/impl/ignite_environment.cpp | 37 +-
.../platforms/cpp/core/src/impl/ignite_impl.cpp | 25 +-
.../core/src/impl/interop/interop_target.cpp | 18 +-
.../cpp/jni/include/ignite/jni/exports.h | 31 +-
.../platforms/cpp/jni/include/ignite/jni/java.h | 70 +--
modules/platforms/cpp/jni/project/vs/module.def | 30 +-
modules/platforms/cpp/jni/src/exports.cpp | 116 +---
modules/platforms/cpp/jni/src/java.cpp | 518 +----------------
.../dotnet/Apache.Ignite.Core/Ignition.cs | 12 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Impl/Cluster/ClusterGroupImpl.cs | 78 ++-
.../Impl/Compute/ComputeImpl.cs | 6 +-
.../Impl/Datastream/DataStreamerImpl.cs | 3 +-
.../Impl/Datastream/StreamReceiverHolder.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 279 +++++-----
.../Apache.Ignite.Core/Impl/Log/JavaLogger.cs | 23 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 18 +-
.../Impl/Plugin/PluginContext.cs | 7 +-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 91 +--
.../Impl/Unmanaged/UnmanagedUtils.cs | 308 +----------
32 files changed, 768 insertions(+), 2023 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
index 5e785e2..4a584f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java
@@ -130,7 +130,7 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
* @return Dummy value which is never returned.
* @throws IgniteCheckedException Exception to be thrown.
*/
- private <T> T throwUnsupported(int type) throws IgniteCheckedException {
+ public static <T> T throwUnsupported(int type) throws IgniteCheckedException {
throw new IgniteCheckedException("Unsupported operation type: " + type);
}
@@ -142,8 +142,8 @@ public abstract class PlatformAbstractTarget implements PlatformTarget {
* @param writer Writer.
* @throws IgniteCheckedException In case of error.
*/
- protected PlatformListenable readAndListenFuture(BinaryRawReader reader, IgniteInternalFuture fut,
- PlatformFutureUtils.Writer writer)
+ private PlatformListenable readAndListenFuture(BinaryRawReader reader, IgniteInternalFuture fut,
+ PlatformFutureUtils.Writer writer)
throws IgniteCheckedException {
long futId = reader.readLong();
int futTyp = reader.readInt();
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
index 422e16e..754c69e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformIgnition.java
@@ -49,9 +49,8 @@ public class PlatformIgnition {
* @param factoryId Factory ID.
* @param envPtr Environment pointer.
* @param dataPtr Optional pointer to additional data required for startup.
- * @return Ignite instance.
*/
- public static synchronized PlatformProcessor start(@Nullable String springCfgPath,
+ public static synchronized void start(@Nullable String springCfgPath,
@Nullable String igniteInstanceName, int factoryId, long envPtr, long dataPtr) {
if (envPtr <= 0)
throw new IgniteException("Environment pointer must be positive.");
@@ -78,8 +77,6 @@ public class PlatformIgnition {
PlatformProcessor old = instances.put(igniteInstanceName, proc);
assert old == null;
-
- return proc;
}
finally {
Thread.currentThread().setContextClassLoader(oldClsLdr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
index cd170ed..f26826e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformNoopProcessor.java
@@ -23,7 +23,6 @@ import org.apache.ignite.IgniteException;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
-import org.jetbrains.annotations.Nullable;
/**
* No-op processor.
@@ -61,139 +60,8 @@ public class PlatformNoopProcessor extends GridProcessorAdapter implements Platf
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy cache(@Nullable String name) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy createCache(@Nullable String name) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateCache(@Nullable String name) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy createCacheFromConfig(long memPtr) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateCacheFromConfig(long memPtr) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void destroyCache(@Nullable String name) throws IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy affinity(@Nullable String name) throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy dataStreamer(@Nullable String cacheName, boolean keepBinary)
- throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy transactions() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy projection() throws IgniteCheckedException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy compute(PlatformTargetProxy grp) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy message(PlatformTargetProxy grp) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy events(PlatformTargetProxy grp) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy services(PlatformTargetProxy grp) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy extensions() {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy extension(int id) {
- return null;
- }
-
- /** {@inheritDoc} */
@Override public void registerStore(PlatformCacheStore store, boolean convertBinary)
throws IgniteCheckedException {
// No-op.
}
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicLong(String name, long initVal, boolean create) throws IgniteException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public void getIgniteConfiguration(long memPtr) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public void getCacheNames(long memPtr) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicSequence(String name, long initVal, boolean create) throws IgniteException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicReference(String name, long memPtr, boolean create) throws IgniteException {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy createNearCache(@Nullable String cacheName, long memPtr) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateNearCache(@Nullable String cacheName, long memPtr) {
- return null;
- }
-
- /** {@inheritDoc} */
- @Override public boolean loggerIsLevelEnabled(int level) {
- return false;
- }
-
- /** {@inheritDoc} */
- @Override public void loggerLog(int level, String message, String category, String errorInfo) {
- // No-op.
- }
-
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy binaryProcessor() {
- return null;
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
index 54f33a7..9c17d78 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessor.java
@@ -62,139 +62,6 @@ public interface PlatformProcessor extends GridProcessor {
public void awaitStart() throws IgniteCheckedException;
/**
- * Get cache.
- *
- * @param name Cache name.
- * @return Cache.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy cache(@Nullable String name) throws IgniteCheckedException;
-
- /**
- * Create cache.
- *
- * @param name Cache name.
- * @return Cache.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy createCache(@Nullable String name) throws IgniteCheckedException;
-
- /**
- * Get or create cache.
- *
- * @param name Cache name.
- * @return Cache.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy getOrCreateCache(@Nullable String name) throws IgniteCheckedException;
-
- /**
- * Create cache.
- *
- * @param memPtr Stream with cache config.
- * @return Cache.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy createCacheFromConfig(long memPtr) throws IgniteCheckedException;
-
- /**
- * Get or create cache.
- *
- * @param memPtr Stream with cache config.
- * @return Cache.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy getOrCreateCacheFromConfig(long memPtr) throws IgniteCheckedException;
-
- /**
- * Destroy dynamically created cache.
- *
- * @param name Cache name.
- * @throws IgniteCheckedException If failed.
- */
- public void destroyCache(@Nullable String name) throws IgniteCheckedException;
-
- /**
- * Get affinity.
- *
- * @param name Cache name.
- * @return Affinity.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy affinity(@Nullable String name) throws IgniteCheckedException;
-
- /**
- * Get data streamer.
- *
- * @param cacheName Cache name.
- * @param keepBinary Binary flag.
- * @return Data streamer.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy dataStreamer(@Nullable String cacheName, boolean keepBinary) throws IgniteCheckedException;
-
- /**
- * Get transactions.
- *
- * @return Transactions.
- */
- public PlatformTargetProxy transactions();
-
- /**
- * Get projection.
- *
- * @return Projection.
- * @throws IgniteCheckedException If failed.
- */
- public PlatformTargetProxy projection() throws IgniteCheckedException;
-
- /**
- * Create interop compute.
- *
- * @param grp Cluster group.
- * @return Compute instance.
- */
- public PlatformTargetProxy compute(PlatformTargetProxy grp);
-
- /**
- * Create interop messaging.
- *
- * @param grp Cluster group.
- * @return Messaging instance.
- */
- public PlatformTargetProxy message(PlatformTargetProxy grp);
-
- /**
- * Create interop events.
- *
- * @param grp Cluster group.
- * @return Events instance.
- */
- public PlatformTargetProxy events(PlatformTargetProxy grp);
-
- /**
- * Create interop services.
- *
- * @param grp Cluster group.
- * @return Services instance.
- */
- public PlatformTargetProxy services(PlatformTargetProxy grp);
-
- /**
- * Get platform extensions. Override this method to provide any additional targets and operations you need.
- *
- * @return Platform extensions.
- */
- public PlatformTargetProxy extensions();
-
- /**
- * Gets platform extension by id.
- *
- * @return Platform extension target.
- */
- public PlatformTargetProxy extension(int id);
-
- /**
* Register cache store.
*
* @param store Store.
@@ -202,87 +69,4 @@ public interface PlatformProcessor extends GridProcessor {
* @throws IgniteCheckedException If failed.
*/
public void registerStore(PlatformCacheStore store, boolean convertBinary) throws IgniteCheckedException;
-
- /**
- * Get or create AtomicLong.
- * @param name Name.
- * @param initVal Initial value.
- * @param create Create flag.
- * @return Platform atomic long.
- */
- public PlatformTargetProxy atomicLong(String name, long initVal, boolean create);
-
- /**
- * Get or create AtomicSequence.
- * @param name Name.
- * @param initVal Initial value.
- * @param create Create flag.
- * @return Platform atomic long.
- */
- public PlatformTargetProxy atomicSequence(String name, long initVal, boolean create);
-
- /**
- * Get or create AtomicReference.
- * @param name Name.
- * @param memPtr Pointer to a stream with initial value. 0 for null initial value.
- * @param create Create flag.
- * @return Platform atomic long.
- */
- public PlatformTargetProxy atomicReference(String name, long memPtr, boolean create);
-
- /**
- * Gets the configuration of the current Ignite instance.
- *
- * @param memPtr Stream to write data to.
- */
- public void getIgniteConfiguration(long memPtr);
-
- /**
- * Gets the cache names.
- *
- * @param memPtr Stream to write data to.
- */
- public void getCacheNames(long memPtr);
-
- /**
- * Starts a near cache on local node if cache was previously started.
- *
- * @param cacheName Cache name.
- * @param memPtr Pointer to a stream with near cache config. 0 for default config.
- * @return Cache.
- */
- public PlatformTargetProxy createNearCache(@Nullable String cacheName, long memPtr);
-
- /**
- * Gets existing near cache with the given name or creates a new one.
- *
- * @param cacheName Cache name.
- * @param memPtr Pointer to a stream with near cache config. 0 for default config.
- * @return Cache.
- */
- public PlatformTargetProxy getOrCreateNearCache(@Nullable String cacheName, long memPtr);
-
- /**
- * Gets a value indicating whether Ignite logger has specified level enabled.
- *
- * @param level Log level.
- */
- public boolean loggerIsLevelEnabled(int level);
-
- /**
- * Logs to the Ignite logger.
- *
- * @param level Log level.
- * @param message Message.
- * @param category Category.
- * @param errorInfo Error info.
- */
- public void loggerLog(int level, String message, String category, String errorInfo);
-
- /**
- * Gets the binary processor.
- *
- * @return Binary processor.
- */
- public PlatformTargetProxy binaryProcessor();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index 1da3112..612f154 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -41,17 +41,13 @@ import org.apache.ignite.internal.processors.platform.cache.PlatformCacheExtensi
import org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity;
import org.apache.ignite.internal.processors.platform.cache.store.PlatformCacheStore;
import org.apache.ignite.internal.processors.platform.cluster.PlatformClusterGroup;
-import org.apache.ignite.internal.processors.platform.compute.PlatformCompute;
import org.apache.ignite.internal.processors.platform.datastreamer.PlatformDataStreamer;
import org.apache.ignite.internal.processors.platform.datastructures.PlatformAtomicLong;
import org.apache.ignite.internal.processors.platform.datastructures.PlatformAtomicReference;
import org.apache.ignite.internal.processors.platform.datastructures.PlatformAtomicSequence;
import org.apache.ignite.internal.processors.platform.dotnet.PlatformDotNetCacheStore;
-import org.apache.ignite.internal.processors.platform.events.PlatformEvents;
import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
import org.apache.ignite.internal.processors.platform.memory.PlatformOutputStream;
-import org.apache.ignite.internal.processors.platform.messaging.PlatformMessaging;
-import org.apache.ignite.internal.processors.platform.services.PlatformServices;
import org.apache.ignite.internal.processors.platform.transactions.PlatformTransactions;
import org.apache.ignite.internal.processors.platform.utils.PlatformConfigurationUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
@@ -74,7 +70,73 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
* GridGain platform processor.
*/
@SuppressWarnings({"ConditionalExpressionWithIdenticalBranches", "unchecked"})
-public class PlatformProcessorImpl extends GridProcessorAdapter implements PlatformProcessor {
+public class PlatformProcessorImpl extends GridProcessorAdapter implements PlatformProcessor, PlatformTarget {
+ /** */
+ private static final int OP_GET_CACHE = 1;
+
+ /** */
+ private static final int OP_CREATE_CACHE = 2;
+
+ /** */
+ private static final int OP_GET_OR_CREATE_CACHE = 3;
+
+ /** */
+ private static final int OP_CREATE_CACHE_FROM_CONFIG = 4;
+
+ /** */
+ private static final int OP_GET_OR_CREATE_CACHE_FROM_CONFIG = 5;
+
+ /** */
+ private static final int OP_DESTROY_CACHE = 6;
+
+ /** */
+ private static final int OP_GET_AFFINITY = 7;
+
+ /** */
+ private static final int OP_GET_DATA_STREAMER = 8;
+
+ /** */
+ private static final int OP_GET_TRANSACTIONS = 9;
+
+ /** */
+ private static final int OP_GET_CLUSTER_GROUP = 10;
+
+ /** */
+ private static final int OP_GET_EXTENSION = 11;
+
+ /** */
+ private static final int OP_GET_ATOMIC_LONG = 12;
+
+ /** */
+ private static final int OP_GET_ATOMIC_REFERENCE = 13;
+
+ /** */
+ private static final int OP_GET_ATOMIC_SEQUENCE = 14;
+
+ /** */
+ private static final int OP_GET_IGNITE_CONFIGURATION = 15;
+
+ /** */
+ private static final int OP_GET_CACHE_NAMES = 16;
+
+ /** */
+ private static final int OP_CREATE_NEAR_CACHE = 17;
+
+ /** */
+ private static final int OP_GET_OR_CREATE_NEAR_CACHE = 18;
+
+ /** */
+ private static final int OP_LOGGER_IS_LEVEL_ENABLED = 19;
+
+ /** */
+ private static final int OP_LOGGER_LOG = 20;
+
+ /** */
+ private static final int OP_GET_BINARY_PROCESSOR = 21;
+
+ /** */
+ private static final int OP_RELEASE_START = 22;
+
/** Start latch. */
private final CountDownLatch startLatch = new CountDownLatch(1);
@@ -157,7 +219,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
out.synchronize();
- platformCtx.gateway().onStart(this, mem.pointer());
+ platformCtx.gateway().onStart(new PlatformTargetProxyImpl(this, platformCtx), mem.pointer());
}
// At this moment all necessary native libraries must be loaded, so we can process with store creation.
@@ -218,321 +280,360 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy cache(@Nullable String name) throws IgniteCheckedException {
- IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().cache(name);
+ @Override public void registerStore(PlatformCacheStore store, boolean convertBinary)
+ throws IgniteCheckedException {
+ storeLock.readLock().lock();
- if (cache == null)
- throw new IllegalArgumentException("Cache doesn't exist: " + name);
+ try {
+ if (stopped)
+ throw new IgniteCheckedException("Failed to initialize interop store because node is stopping: " +
+ store);
- return createPlatformCache(cache);
+ if (started)
+ registerStore0(store, convertBinary);
+ else
+ pendingStores.add(new StoreInfo(store, convertBinary));
+ }
+ finally {
+ storeLock.readLock().unlock();
+ }
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy createCache(@Nullable String name) throws IgniteCheckedException {
- IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().createCache(name);
-
- assert cache != null;
+ @Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
+ platformCtx.gateway().onClientDisconnected();
- return createPlatformCache(cache);
+ // 1) onReconnected is called on all grid components.
+ // 2) After all of grid components have completed their reconnection, reconnectFut is completed.
+ reconnectFut.listen(new CI1<IgniteFuture<?>>() {
+ @Override public void apply(IgniteFuture<?> future) {
+ platformCtx.gateway().onClientReconnected(clusterRestarted);
+ }
+ });
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateCache(@Nullable String name) throws IgniteCheckedException {
- IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().getOrCreateCache(name);
+ @Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException {
+ // Save the flag value for callback of reconnectFut.
+ this.clusterRestarted = clusterRestarted;
+
+ return null;
+ }
+ /**
+ * Creates new platform cache.
+ */
+ private PlatformTarget createPlatformCache(IgniteCacheProxy cache) {
assert cache != null;
- return createPlatformCache(cache);
+ return new PlatformCache(platformCtx, cache, false, cacheExts);
}
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy createCacheFromConfig(long memPtr) throws IgniteCheckedException {
- BinaryRawReaderEx reader = platformCtx.reader(platformCtx.memory().get(memPtr));
- CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
+ /**
+ * Checks whether logger level is enabled.
+ *
+ * @param level Level.
+ * @return Result.
+ */
+ private boolean loggerIsLevelEnabled(int level) {
+ IgniteLogger log = ctx.grid().log();
- IgniteCacheProxy cache = reader.readBoolean()
- ? (IgniteCacheProxy)ctx.grid().createCache(cfg, PlatformConfigurationUtils.readNearConfiguration(reader))
- : (IgniteCacheProxy)ctx.grid().createCache(cfg);
+ switch (level) {
+ case PlatformLogger.LVL_TRACE:
+ return log.isTraceEnabled();
+ case PlatformLogger.LVL_DEBUG:
+ return log.isDebugEnabled();
+ case PlatformLogger.LVL_INFO:
+ return log.isInfoEnabled();
+ case PlatformLogger.LVL_WARN:
+ return true;
+ case PlatformLogger.LVL_ERROR:
+ return true;
+ default:
+ assert false;
+ }
- return createPlatformCache(cache);
+ return false;
}
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateCacheFromConfig(long memPtr) throws IgniteCheckedException {
- BinaryRawReaderEx reader = platformCtx.reader(platformCtx.memory().get(memPtr));
- CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
+ /**
+ * Logs to the Ignite logger.
+ *
+ * @param level Level.
+ * @param message Message.
+ * @param category Category.
+ * @param errorInfo Exception.
+ */
+ private void loggerLog(int level, String message, String category, String errorInfo) {
+ IgniteLogger log = ctx.grid().log();
- IgniteCacheProxy cache = reader.readBoolean()
- ? (IgniteCacheProxy)ctx.grid().getOrCreateCache(cfg,
- PlatformConfigurationUtils.readNearConfiguration(reader))
- : (IgniteCacheProxy)ctx.grid().getOrCreateCache(cfg);
+ if (category != null)
+ log = log.getLogger(category);
- return createPlatformCache(cache);
- }
+ Throwable err = errorInfo == null ? null : new IgniteException("Platform error:" + errorInfo);
- /** {@inheritDoc} */
- @Override public void destroyCache(@Nullable String name) throws IgniteCheckedException {
- ctx.grid().destroyCache(name);
+ switch (level) {
+ case PlatformLogger.LVL_TRACE:
+ log.trace(message);
+ break;
+ case PlatformLogger.LVL_DEBUG:
+ log.debug(message);
+ break;
+ case PlatformLogger.LVL_INFO:
+ log.info(message);
+ break;
+ case PlatformLogger.LVL_WARN:
+ log.warning(message, err);
+ break;
+ case PlatformLogger.LVL_ERROR:
+ log.error(message, err);
+ break;
+ default:
+ assert false;
+ }
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy affinity(@Nullable String name) throws IgniteCheckedException {
- return proxy(new PlatformAffinity(platformCtx, ctx, name));
+ @Override public long processInLongOutLong(int type, long val) throws IgniteCheckedException {
+ switch (type) {
+ case OP_LOGGER_IS_LEVEL_ENABLED: {
+ return loggerIsLevelEnabled((int) val) ? PlatformAbstractTarget.TRUE : PlatformAbstractTarget.FALSE;
+ }
+
+ case OP_RELEASE_START: {
+ releaseStart();
+
+ return 0;
+ }
+ }
+
+ return PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy dataStreamer(@Nullable String cacheName, boolean keepBinary)
- throws IgniteCheckedException {
- IgniteDataStreamer ldr = ctx.dataStream().dataStreamer(cacheName);
+ @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ switch (type) {
+ case OP_DESTROY_CACHE: {
+ ctx.grid().destroyCache(reader.readString());
+
+ return 0;
+ }
- ldr.keepBinary(true);
+ case OP_LOGGER_LOG: {
+ loggerLog(reader.readInt(), reader.readString(), reader.readString(), reader.readString());
- return proxy(new PlatformDataStreamer(platformCtx, cacheName, (DataStreamerImpl)ldr, keepBinary));
+ return 0;
+ }
+ }
+
+ return PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy transactions() {
- return proxy(new PlatformTransactions(platformCtx));
+ @Override public long processInStreamOutLong(int type, BinaryRawReaderEx reader, PlatformMemory mem) throws IgniteCheckedException {
+ return processInStreamOutLong(type, reader);
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy projection() throws IgniteCheckedException {
- return proxy(new PlatformClusterGroup(platformCtx, ctx.grid().cluster()));
+ @Override public void processInStreamOutStream(int type, BinaryRawReaderEx reader, BinaryRawWriterEx writer) throws IgniteCheckedException {
+ PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy compute(PlatformTargetProxy grp) {
- PlatformClusterGroup grp0 = (PlatformClusterGroup)grp.unwrap();
+ @Override public PlatformTarget processInStreamOutObject(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ switch (type) {
+ case OP_GET_CACHE: {
+ String name = reader.readString();
- return proxy(new PlatformCompute(platformCtx, grp0.projection(), PlatformUtils.ATTR_PLATFORM));
- }
+ IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().cache(name);
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy message(PlatformTargetProxy grp) {
- PlatformClusterGroup grp0 = (PlatformClusterGroup)grp.unwrap();
+ if (cache == null)
+ throw new IllegalArgumentException("Cache doesn't exist: " + name);
- return proxy(new PlatformMessaging(platformCtx, grp0.projection().ignite().message(grp0.projection())));
- }
+ return createPlatformCache(cache);
+ }
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy events(PlatformTargetProxy grp) {
- PlatformClusterGroup grp0 = (PlatformClusterGroup)grp.unwrap();
+ case OP_CREATE_CACHE: {
+ String name = reader.readString();
- return proxy(new PlatformEvents(platformCtx, grp0.projection().ignite().events(grp0.projection())));
- }
+ IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().createCache(name);
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy services(PlatformTargetProxy grp) {
- PlatformClusterGroup grp0 = (PlatformClusterGroup)grp.unwrap();
+ return createPlatformCache(cache);
+ }
- return proxy(new PlatformServices(platformCtx, grp0.projection().ignite().services(grp0.projection()), false));
- }
+ case OP_GET_OR_CREATE_CACHE: {
+ String name = reader.readString();
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy extensions() {
- return null;
- }
+ IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().getOrCreateCache(name);
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy extension(int id) {
- if (extensions != null && id < extensions.length) {
- PlatformPluginExtension ext = extensions[id];
+ return createPlatformCache(cache);
+ }
- if (ext != null)
- return proxy(ext.createTarget());
- }
+ case OP_CREATE_CACHE_FROM_CONFIG: {
+ CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
- throw new IgniteException("Platform extension is not registered [id=" + id + ']');
- }
+ IgniteCacheProxy cache = reader.readBoolean()
+ ? (IgniteCacheProxy)ctx.grid().createCache(cfg, PlatformConfigurationUtils.readNearConfiguration(reader))
+ : (IgniteCacheProxy)ctx.grid().createCache(cfg);
- /** {@inheritDoc} */
- @Override public void registerStore(PlatformCacheStore store, boolean convertBinary)
- throws IgniteCheckedException {
- storeLock.readLock().lock();
+ return createPlatformCache(cache);
+ }
- try {
- if (stopped)
- throw new IgniteCheckedException("Failed to initialize interop store because node is stopping: " +
- store);
+ case OP_GET_OR_CREATE_CACHE_FROM_CONFIG: {
+ CacheConfiguration cfg = PlatformConfigurationUtils.readCacheConfiguration(reader);
- if (started)
- registerStore0(store, convertBinary);
- else
- pendingStores.add(new StoreInfo(store, convertBinary));
- }
- finally {
- storeLock.readLock().unlock();
- }
- }
+ IgniteCacheProxy cache = reader.readBoolean()
+ ? (IgniteCacheProxy)ctx.grid().getOrCreateCache(cfg,
+ PlatformConfigurationUtils.readNearConfiguration(reader))
+ : (IgniteCacheProxy)ctx.grid().getOrCreateCache(cfg);
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicLong(String name, long initVal, boolean create) throws IgniteException {
- GridCacheAtomicLongImpl atomicLong = (GridCacheAtomicLongImpl)ignite().atomicLong(name, initVal, create);
+ return createPlatformCache(cache);
+ }
- if (atomicLong == null)
- return null;
+ case OP_GET_AFFINITY: {
+ return new PlatformAffinity(platformCtx, ctx, reader.readString());
+ }
- return proxy(new PlatformAtomicLong(platformCtx, atomicLong));
- }
+ case OP_GET_DATA_STREAMER: {
+ String cacheName = reader.readString();
+ boolean keepBinary = reader.readBoolean();
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicSequence(String name, long initVal, boolean create)
- throws IgniteException {
- IgniteAtomicSequence atomicSeq = ignite().atomicSequence(name, initVal, create);
+ IgniteDataStreamer ldr = ctx.dataStream().dataStreamer(cacheName);
- if (atomicSeq == null)
- return null;
+ ldr.keepBinary(true);
- return proxy(new PlatformAtomicSequence(platformCtx, atomicSeq));
- }
+ return new PlatformDataStreamer(platformCtx, cacheName, (DataStreamerImpl)ldr, keepBinary);
+ }
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy atomicReference(String name, long memPtr, boolean create)
- throws IgniteException {
- PlatformAtomicReference ref = PlatformAtomicReference.createInstance(platformCtx, name, memPtr, create);
+ case OP_GET_EXTENSION: {
+ int id = reader.readInt();
- return ref != null ? proxy(ref) : null;
- }
+ if (extensions != null && id < extensions.length) {
+ PlatformPluginExtension ext = extensions[id];
- /** {@inheritDoc} */
- @Override public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException {
- platformCtx.gateway().onClientDisconnected();
+ if (ext != null) {
+ return ext.createTarget();
+ }
+ }
- // 1) onReconnected is called on all grid components.
- // 2) After all of grid components have completed their reconnection, reconnectFut is completed.
- reconnectFut.listen(new CI1<IgniteFuture<?>>() {
- @Override public void apply(IgniteFuture<?> future) {
- platformCtx.gateway().onClientReconnected(clusterRestarted);
+ throw new IgniteException("Platform extension is not registered [id=" + id + ']');
}
- });
- }
- /** {@inheritDoc} */
- @Override public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException {
- // Save the flag value for callback of reconnectFut.
- this.clusterRestarted = clusterRestarted;
+ case OP_GET_ATOMIC_LONG: {
+ String name = reader.readString();
+ long initVal = reader.readLong();
+ boolean create = reader.readBoolean();
- return null;
- }
+ GridCacheAtomicLongImpl atomicLong = (GridCacheAtomicLongImpl)ignite().atomicLong(name, initVal, create);
- /** {@inheritDoc} */
- @Override public void getIgniteConfiguration(long memPtr) {
- PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
- BinaryRawWriterEx writer = platformCtx.writer(stream);
+ if (atomicLong == null)
+ return null;
- PlatformConfigurationUtils.writeIgniteConfiguration(writer, ignite().configuration());
+ return new PlatformAtomicLong(platformCtx, atomicLong);
+ }
- stream.synchronize();
- }
+ case OP_GET_ATOMIC_REFERENCE: {
+ String name = reader.readString();
+ Object initVal = reader.readObjectDetached();
+ boolean create = reader.readBoolean();
- /** {@inheritDoc} */
- @Override public void getCacheNames(long memPtr) {
- PlatformOutputStream stream = platformCtx.memory().get(memPtr).output();
- BinaryRawWriterEx writer = platformCtx.writer(stream);
+ return PlatformAtomicReference.createInstance(platformCtx, name, initVal, create);
+ }
- Collection<String> names = ignite().cacheNames();
+ case OP_GET_ATOMIC_SEQUENCE: {
+ String name = reader.readString();
+ long initVal = reader.readLong();
+ boolean create = reader.readBoolean();
- writer.writeInt(names.size());
+ IgniteAtomicSequence atomicSeq = ignite().atomicSequence(name, initVal, create);
- for (String name : names)
- writer.writeString(name);
+ if (atomicSeq == null)
+ return null;
- stream.synchronize();
- }
+ return new PlatformAtomicSequence(platformCtx, atomicSeq);
+ }
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy createNearCache(@Nullable String cacheName, long memPtr) {
- NearCacheConfiguration cfg = getNearCacheConfiguration(memPtr);
+ case OP_CREATE_NEAR_CACHE: {
+ String cacheName = reader.readString();
- IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().createNearCache(cacheName, cfg);
+ NearCacheConfiguration cfg = PlatformConfigurationUtils.readNearConfiguration(reader);
- return createPlatformCache(cache);
- }
+ IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().createNearCache(cacheName, cfg);
- /** {@inheritDoc} */
- @Override public PlatformTargetProxy getOrCreateNearCache(@Nullable String cacheName, long memPtr) {
- NearCacheConfiguration cfg = getNearCacheConfiguration(memPtr);
+ return createPlatformCache(cache);
+ }
+
+ case OP_GET_OR_CREATE_NEAR_CACHE: {
+ String cacheName = reader.readString();
- IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().getOrCreateNearCache(cacheName, cfg);
+ NearCacheConfiguration cfg = PlatformConfigurationUtils.readNearConfiguration(reader);
- return createPlatformCache(cache);
+ IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().getOrCreateNearCache(cacheName, cfg);
+
+ return createPlatformCache(cache);
+ }
+ }
+
+ return PlatformAbstractTarget.throwUnsupported(type);
}
- /**
- * Creates new platform cache.
- */
- private PlatformTargetProxy createPlatformCache(IgniteCacheProxy cache) {
- return proxy(new PlatformCache(platformCtx, cache, false, cacheExts));
+ /** {@inheritDoc} */
+ @Override public PlatformTarget processInObjectStreamOutObjectStream(int type, @Nullable PlatformTarget arg,
+ BinaryRawReaderEx reader,
+ BinaryRawWriterEx writer)
+ throws IgniteCheckedException {
+ return PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public boolean loggerIsLevelEnabled(int level) {
- IgniteLogger log = ctx.grid().log();
+ @Override public void processOutStream(int type, BinaryRawWriterEx writer) throws IgniteCheckedException {
+ switch (type) {
+ case OP_GET_IGNITE_CONFIGURATION: {
+ PlatformConfigurationUtils.writeIgniteConfiguration(writer, ignite().configuration());
- switch (level) {
- case PlatformLogger.LVL_TRACE:
- return log.isTraceEnabled();
- case PlatformLogger.LVL_DEBUG:
- return log.isDebugEnabled();
- case PlatformLogger.LVL_INFO:
- return log.isInfoEnabled();
- case PlatformLogger.LVL_WARN:
- return true;
- case PlatformLogger.LVL_ERROR:
- return true;
- default:
- assert false;
+ return;
+ }
+
+ case OP_GET_CACHE_NAMES: {
+ Collection<String> names = ignite().cacheNames();
+
+ writer.writeInt(names.size());
+
+ for (String name : names)
+ writer.writeString(name);
+
+ return;
+ }
}
- return false;
+ PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public void loggerLog(int level, String message, String category, String errorInfo) {
- IgniteLogger log = ctx.grid().log();
+ @Override public PlatformTarget processOutObject(int type) throws IgniteCheckedException {
+ switch (type) {
+ case OP_GET_TRANSACTIONS:
+ return new PlatformTransactions(platformCtx);
- if (category != null)
- log = log.getLogger(category);
+ case OP_GET_CLUSTER_GROUP:
+ return new PlatformClusterGroup(platformCtx, ctx.grid().cluster());
- Throwable err = errorInfo == null ? null : new IgniteException("Platform error:" + errorInfo);
-
- switch (level) {
- case PlatformLogger.LVL_TRACE:
- log.trace(message);
- break;
- case PlatformLogger.LVL_DEBUG:
- log.debug(message);
- break;
- case PlatformLogger.LVL_INFO:
- log.info(message);
- break;
- case PlatformLogger.LVL_WARN:
- log.warning(message, err);
- break;
- case PlatformLogger.LVL_ERROR:
- log.error(message, err);
- break;
- default:
- assert false;
+ case OP_GET_BINARY_PROCESSOR: {
+ return new PlatformBinaryProcessor(platformCtx);
+ }
}
+
+ return PlatformAbstractTarget.throwUnsupported(type);
}
/** {@inheritDoc} */
- @Override public PlatformTargetProxy binaryProcessor() {
- return proxy(new PlatformBinaryProcessor(platformCtx));
+ @Override public PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException {
+ return PlatformAbstractTarget.throwUnsupported(type);
}
- /**
- * Gets the near cache config.
- *
- * @param memPtr Memory pointer.
- * @return Near config.
- */
- private NearCacheConfiguration getNearCacheConfiguration(long memPtr) {
- assert memPtr != 0;
-
- BinaryRawReaderEx reader = platformCtx.reader(platformCtx.memory().get(memPtr));
- return PlatformConfigurationUtils.readNearConfiguration(reader);
+ /** {@inheritDoc} */
+ @Override public Exception convertException(Exception e) {
+ return e;
}
/**
@@ -635,13 +736,6 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
}
/**
- * Wraps target in a proxy.
- */
- private PlatformTargetProxy proxy(PlatformTarget target) {
- return new PlatformTargetProxyImpl(target, platformCtx);
- }
-
- /**
* Store and manager pair.
*/
private static class StoreInfo {
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
index f6e3d2e..7c1c03e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java
@@ -36,6 +36,10 @@ import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformTarget;
import org.apache.ignite.internal.processors.platform.cache.PlatformCache;
+import org.apache.ignite.internal.processors.platform.compute.PlatformCompute;
+import org.apache.ignite.internal.processors.platform.events.PlatformEvents;
+import org.apache.ignite.internal.processors.platform.messaging.PlatformMessaging;
+import org.apache.ignite.internal.processors.platform.services.PlatformServices;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.jetbrains.annotations.Nullable;
@@ -126,6 +130,19 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
/** */
private static final int OP_PERSISTENT_STORE_METRICS = 30;
+ /** */
+ private static final int OP_GET_COMPUTE = 31;
+
+ /** */
+ private static final int OP_GET_MESSAGING = 32;
+
+ /** */
+ private static final int OP_GET_EVENTS = 33;
+
+ /** */
+ private static final int OP_GET_SERVICES = 34;
+
+
/** Projection. */
private final ClusterGroupEx prj;
@@ -381,6 +398,18 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
case OP_FOR_SERVERS:
return new PlatformClusterGroup(platformCtx, (ClusterGroupEx)prj.forServers());
+
+ case OP_GET_COMPUTE:
+ return new PlatformCompute(platformCtx, prj, PlatformUtils.ATTR_PLATFORM);
+
+ case OP_GET_MESSAGING:
+ return new PlatformMessaging(platformCtx, platformCtx.kernalContext().grid().message(prj));
+
+ case OP_GET_EVENTS:
+ return new PlatformEvents(platformCtx, platformCtx.kernalContext().grid().events(prj));
+
+ case OP_GET_SERVICES:
+ return new PlatformServices(platformCtx, platformCtx.kernalContext().grid().services(prj),false);
}
return super.processOutObject(type);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
index a644259..93c0040 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/datastructures/PlatformAtomicReference.java
@@ -23,7 +23,6 @@ import org.apache.ignite.internal.binary.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.datastructures.GridCacheAtomicReferenceImpl;
import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget;
import org.apache.ignite.internal.processors.platform.PlatformContext;
-import org.apache.ignite.internal.processors.platform.memory.PlatformMemory;
/**
* Platform atomic reference wrapper.
@@ -53,23 +52,15 @@ public class PlatformAtomicReference extends PlatformAbstractTarget {
*
* @param ctx Context.
* @param name Name.
- * @param memPtr Pointer to a stream with initial value. 0 for default value.
+ * @param initVal Initial value.
* @param create Create flag.
* @return Instance of a PlatformAtomicReference, or null when Ignite reference with specific name is null.
*/
- public static PlatformAtomicReference createInstance(PlatformContext ctx, String name, long memPtr,
+ public static PlatformAtomicReference createInstance(PlatformContext ctx, String name, Object initVal,
boolean create) {
assert ctx != null;
assert name != null;
- Object initVal = null;
-
- if (memPtr != 0) {
- try (PlatformMemory mem = ctx.memory().get(memPtr)) {
- initVal = ctx.reader(mem).readObjectDetached();
- }
- }
-
GridCacheAtomicReferenceImpl atomicRef =
(GridCacheAtomicReferenceImpl)ctx.kernalContext().grid().atomicReference(name, initVal, create);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/include/ignite/ignite.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/ignite.h b/modules/platforms/cpp/core/include/ignite/ignite.h
index b3b06f0..07134a1 100644
--- a/modules/platforms/cpp/core/include/ignite/ignite.h
+++ b/modules/platforms/cpp/core/include/ignite/ignite.h
@@ -102,7 +102,7 @@ namespace ignite
template<typename K, typename V>
cache::Cache<K, V> GetCache(const char* name, IgniteError& err)
{
- impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, err);
+ impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache(name, err);
return cache::Cache<K, V>(cacheImpl);
}
@@ -139,7 +139,7 @@ namespace ignite
template<typename K, typename V>
cache::Cache<K, V> GetOrCreateCache(const char* name, IgniteError& err)
{
- impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, err);
+ impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache(name, err);
return cache::Cache<K, V>(cacheImpl);
}
@@ -176,7 +176,7 @@ namespace ignite
template<typename K, typename V>
cache::Cache<K, V> CreateCache(const char* name, IgniteError& err)
{
- impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, err);
+ impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache(name, err);
return cache::Cache<K, V>(cacheImpl);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
index 4ba1c1c..2b04dcb 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/compute/compute_impl.h
@@ -208,7 +208,10 @@ namespace ignite
out.Synchronize();
- jobject target = InStreamOutObject(operation, *mem.Get());
+ IgniteError err;
+ jobject target = InStreamOutObject(operation, *mem.Get(), err);
+ IgniteError::ThrowIfNeeded(err);
+
std::auto_ptr<common::Cancelable> cancelable(new CancelableImpl(GetEnvironmentPointer(), target));
return cancelable;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
index baddec4..d1763c4 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/ignite_impl.h
@@ -28,14 +28,34 @@
#include <ignite/impl/cluster/cluster_group_impl.h>
#include <ignite/impl/compute/compute_impl.h>
+using namespace ignite::impl::interop;
+using namespace ignite::common::concurrent;
+using namespace ignite::impl::binary;
+using namespace ignite::binary;
+
namespace ignite
{
namespace impl
{
+ /*
+ * PlatformProcessor op codes.
+ */
+ struct ProcessorOp
+ {
+ enum Type
+ {
+ GET_CACHE = 1,
+ CREATE_CACHE = 2,
+ GET_OR_CREATE_CACHE = 3,
+ GET_TRANSACTIONS = 9,
+ GET_CLUSTER_GROUP = 10,
+ };
+ };
+
/**
* Ignite implementation.
*/
- class IGNITE_FRIEND_EXPORT IgniteImpl
+ class IGNITE_FRIEND_EXPORT IgniteImpl : private interop::InteropTarget
{
typedef common::concurrent::SharedPointer<IgniteEnvironment> SP_IgniteEnvironment;
typedef common::concurrent::SharedPointer<transactions::TransactionsImpl> SP_TransactionsImpl;
@@ -48,14 +68,9 @@ namespace ignite
* @param env Environment.
* @param javaRef Reference to java object.
*/
- IgniteImpl(SP_IgniteEnvironment env, jobject javaRef);
+ IgniteImpl(SP_IgniteEnvironment env);
/**
- * Destructor.
- */
- ~IgniteImpl();
-
- /**
* Get name of the Ignite.
*
* @return Name.
@@ -82,23 +97,9 @@ namespace ignite
* @param name Cache name.
* @param err Error.
*/
- template<typename K, typename V>
cache::CacheImpl* GetCache(const char* name, IgniteError& err)
{
- ignite::jni::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = common::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
+ return GetOrCreateCache(name, err, ProcessorOp::GET_CACHE);
}
/**
@@ -107,23 +108,9 @@ namespace ignite
* @param name Cache name.
* @param err Error.
*/
- template<typename K, typename V>
cache::CacheImpl* GetOrCreateCache(const char* name, IgniteError& err)
{
- ignite::jni::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorGetOrCreateCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = common::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
+ return GetOrCreateCache(name, err, ProcessorOp::GET_OR_CREATE_CACHE);
}
/**
@@ -132,23 +119,9 @@ namespace ignite
* @param name Cache name.
* @param err Error.
*/
- template<typename K, typename V>
cache::CacheImpl* CreateCache(const char* name, IgniteError& err)
{
- ignite::jni::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorCreateCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = common::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
+ return GetOrCreateCache(name, err, ProcessorOp::CREATE_CACHE);
}
/**
@@ -227,9 +200,6 @@ namespace ignite
/** Environment. */
SP_IgniteEnvironment env;
- /** Native Java counterpart. */
- jobject javaRef;
-
/** Transactions implementaion. */
SP_TransactionsImpl txImpl;
@@ -237,6 +207,38 @@ namespace ignite
cluster::SP_ClusterGroupImpl prjImpl;
IGNITE_NO_COPY_ASSIGNMENT(IgniteImpl)
+
+ /**
+ * Get or create cache.
+ *
+ * @param name Cache name.
+ * @param err Error.
+ * @param op Operation code.
+ */
+ cache::CacheImpl* GetOrCreateCache(const char* name, IgniteError& err, int32_t op)
+ {
+ SharedPointer<InteropMemory> mem = env.Get()->AllocateMemory();
+ InteropMemory* mem0 = mem.Get();
+ InteropOutputStream out(mem0);
+ BinaryWriterImpl writer(&out, env.Get()->GetTypeManager());
+ BinaryRawWriter rawWriter(&writer);
+
+ rawWriter.WriteString(name);
+
+ out.Synchronize();
+
+ jobject cacheJavaRef = InStreamOutObject(op, *mem0, err);
+
+ if (!cacheJavaRef)
+ {
+ return NULL;
+ }
+
+ char* name0 = common::CopyChars(name);
+
+ return new cache::CacheImpl(name0, env, cacheJavaRef);
+ }
+
};
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
index 0384dcc..29a3a2d 100644
--- a/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
+++ b/modules/platforms/cpp/core/include/ignite/impl/interop/interop_target.h
@@ -60,6 +60,16 @@ namespace ignite
InteropTarget(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
/**
+ * Constructor used to create new instance.
+ *
+ * @param env Environment.
+ * @param javaRef Reference to java object.
+ * @param javaRef Whether javaRef release in destructor should be skipped.
+ */
+ InteropTarget(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef,
+ bool skipJavaRefRelease);
+
+ /**
* Destructor.
*/
virtual ~InteropTarget();
@@ -139,9 +149,10 @@ namespace ignite
*
* @param opType Type of operation.
* @param outInMem Input and output memory.
+ * @param err Error.
* @return Java object references.
*/
- jobject InStreamOutObject(int32_t opType, InteropMemory& outInMem);
+ jobject InStreamOutObject(int32_t opType, InteropMemory& outInMem, IgniteError& err);
/**
* Internal out-in operation.
@@ -190,6 +201,9 @@ namespace ignite
/** Handle to Java object. */
jobject javaRef;
+ /** javaRef release flag. */
+ bool skipJavaRefRelease;
+
IGNITE_NO_COPY_ASSIGNMENT(InteropTarget)
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/src/ignition.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/ignition.cpp b/modules/platforms/cpp/core/src/ignition.cpp
index e12a208..bc25b07 100644
--- a/modules/platforms/cpp/core/src/ignition.cpp
+++ b/modules/platforms/cpp/core/src/ignition.cpp
@@ -301,13 +301,13 @@ namespace ignite
stream.WriteBool(false);
stream.Synchronize();
- jobject javaRef = ctx.Get()->IgnitionStart(&springCfgPath0[0], namep, 2, mem.PointerLong(), &jniErr);
+ ctx.Get()->IgnitionStart(&springCfgPath0[0], namep, 2, mem.PointerLong(), &jniErr);
// Releasing control over environment as it is controlled by Java at this point.
// Even if the call has failed environment are going to be released by the Java.
envTarget.release();
- if (!javaRef)
+ if (!env.Get()->GetProcessor())
{
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
@@ -323,7 +323,7 @@ namespace ignite
env.Get()->ProcessorReleaseStart();
- IgniteImpl* impl = new IgniteImpl(env, javaRef);
+ IgniteImpl* impl = new IgniteImpl(env);
return Ignite(impl);
}
@@ -383,22 +383,9 @@ namespace ignite
SharedPointer<IgniteEnvironment>* env =
static_cast<SharedPointer<IgniteEnvironment>*>(hnds->target);
- // 4. Get fresh node reference.
- jobject ref = ctx.Get()->IgnitionInstance(name0, &jniErr);
+ IgniteImpl* impl = new IgniteImpl(*env);
- if (err.GetCode() == IgniteError::IGNITE_SUCCESS) {
- if (ref)
- {
- IgniteImpl* impl = new IgniteImpl(*env, ref);
-
- res = Ignite(impl);
- }
- else
- // Error: concurrent node stop.
- err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get Ignite instance because it was stopped concurrently.");
-
- }
+ res = Ignite(impl);
}
else
// Error: no node with the given name.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
index 4e78f09..e5ce004 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_environment.cpp
@@ -61,7 +61,30 @@ namespace ignite
ON_START = 49,
ON_STOP = 50,
COMPUTE_TASK_LOCAL_JOB_RESULT = 60,
- COMPUTE_JOB_EXECUTE_LOCAL = 61
+ COMPUTE_JOB_EXECUTE_LOCAL = 61,
+ };
+ };
+
+ /*
+ * PlatformProcessor op codes.
+ */
+ struct ProcessorOp
+ {
+ enum Type
+ {
+ GET_BINARY_PROCESSOR = 21,
+ RELEASE_START = 22
+ };
+ };
+
+ /*
+ * PlatformClusterGroup op codes.
+ */
+ struct ClusterGroupOp
+ {
+ enum Type
+ {
+ GET_COMPUTE = 31
};
};
@@ -298,7 +321,10 @@ namespace ignite
{
latch.CountDown();
- jobject binaryProc = Context()->ProcessorBinaryProcessor(proc.Get());
+ JniErrorInfo jniErr;
+
+ jobject binaryProc = Context()->TargetOutObject(proc.Get(), ProcessorOp::GET_BINARY_PROCESSOR, &jniErr);
+
metaUpdater = new BinaryTypeUpdaterImpl(*this, binaryProc);
metaMgr->SetUpdater(metaUpdater);
@@ -375,7 +401,7 @@ namespace ignite
{
JniErrorInfo jniErr;
- jobject res = ctx.Get()->ProcessorCompute(proc.Get(), proj, &jniErr);
+ jobject res = ctx.Get()->TargetOutObject(proj, ClusterGroupOp::GET_COMPUTE, &jniErr);
IgniteError err;
@@ -557,7 +583,10 @@ namespace ignite
void IgniteEnvironment::ProcessorReleaseStart()
{
if (proc.Get())
- ctx.Get()->ProcessorReleaseStart(proc.Get());
+ {
+ JniErrorInfo jniErr;
+ ctx.Get()->TargetInLongOutLong(proc.Get(), ProcessorOp::RELEASE_START, 0, &jniErr);
+ }
}
HandleRegistry& IgniteEnvironment::GetHandleRegistry()
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
index 16e954c..f7ff185 100644
--- a/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
+++ b/modules/platforms/cpp/core/src/impl/ignite_impl.cpp
@@ -24,9 +24,9 @@ namespace ignite
{
namespace impl
{
- IgniteImpl::IgniteImpl(SharedPointer<IgniteEnvironment> env, jobject javaRef) :
- env(env),
- javaRef(javaRef)
+ IgniteImpl::IgniteImpl(SharedPointer<IgniteEnvironment> env) :
+ InteropTarget(env, static_cast<jobject>(env.Get()->GetProcessor()), true),
+ env(env)
{
IgniteError err;
@@ -39,11 +39,6 @@ namespace ignite
IgniteError::ThrowIfNeeded(err);
}
- IgniteImpl::~IgniteImpl()
- {
- JniContext::Release(javaRef);
- }
-
const char* IgniteImpl::GetName() const
{
return env.Get()->InstanceName();
@@ -75,14 +70,10 @@ namespace ignite
{
SP_TransactionsImpl res;
- JniErrorInfo jniErr;
-
- jobject txJavaRef = env.Get()->Context()->ProcessorTransactions(javaRef, &jniErr);
+ jobject txJavaRef = InOpObject(ProcessorOp::GET_TRANSACTIONS, err);
if (txJavaRef)
res = SP_TransactionsImpl(new transactions::TransactionsImpl(env, txJavaRef));
- else
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
return res;
}
@@ -93,12 +84,10 @@ namespace ignite
JniErrorInfo jniErr;
- jobject txJavaRef = env.Get()->Context()->ProcessorProjection(javaRef, &jniErr);
+ jobject clusterGroupJavaRef = InOpObject(ProcessorOp::GET_CLUSTER_GROUP, err);
- if (txJavaRef)
- res = cluster::SP_ClusterGroupImpl(new cluster::ClusterGroupImpl(env, txJavaRef));
- else
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
+ if (clusterGroupJavaRef)
+ res = cluster::SP_ClusterGroupImpl(new cluster::ClusterGroupImpl(env, clusterGroupJavaRef));
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
index 7eed6f3..70db2c9 100644
--- a/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
+++ b/modules/platforms/cpp/core/src/impl/interop/interop_target.cpp
@@ -32,14 +32,24 @@ namespace ignite
namespace interop
{
InteropTarget::InteropTarget(SharedPointer<IgniteEnvironment> env, jobject javaRef) :
- env(env), javaRef(javaRef)
+ env(env), javaRef(javaRef), skipJavaRefRelease(false)
+ {
+ // No-op.
+ }
+
+ InteropTarget::InteropTarget(SharedPointer<IgniteEnvironment> env, jobject javaRef,
+ bool skipJavaRefRelease) :
+ env(env), javaRef(javaRef), skipJavaRefRelease(skipJavaRefRelease)
{
// No-op.
}
InteropTarget::~InteropTarget()
{
- JniContext::Release(javaRef);
+ if (!skipJavaRefRelease)
+ {
+ JniContext::Release(javaRef);
+ }
}
int64_t InteropTarget::WriteTo(InteropMemory* mem, InputOperation& inOp, IgniteError& err)
@@ -216,7 +226,7 @@ namespace ignite
return OperationResult::AI_ERROR;
}
- jobject InteropTarget::InStreamOutObject(int32_t opType, InteropMemory& outInMem)
+ jobject InteropTarget::InStreamOutObject(int32_t opType, InteropMemory& outInMem, IgniteError& err)
{
JniErrorInfo jniErr;
@@ -226,9 +236,7 @@ namespace ignite
{
jobject res = env.Get()->Context()->TargetInStreamOutObject(javaRef, opType, outInPtr, &jniErr);
- IgniteError err;
IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- IgniteError::ThrowIfNeeded(err);
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/include/ignite/jni/exports.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/exports.h b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
index 6fe91c7..ea0c32a 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/exports.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/exports.h
@@ -25,40 +25,11 @@ namespace gcj = ignite::jni::java;
extern "C" {
int IGNITE_CALL IgniteReallocate(long long memPtr, int cap);
- void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr);
- void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name);
+ void IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr);
long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name);
bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* name, bool cancel);
void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel);
- void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorProjection(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr);
- void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr);
- void* IGNITE_CALL IgniteProcessorCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr);
- void* IGNITE_CALL IgniteProcessorGetOrCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr);
- void IGNITE_CALL IgniteProcessorDestroyCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable);
- void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorMessage(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorExtension(gcj::JniContext* ctx, void* obj, int id);
- void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
- void* IGNITE_CALL IgniteProcessorAtomicSequence(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create);
- void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create);
- void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr);
- void IGNITE_CALL IgniteProcessorGetCacheNames(gcj::JniContext* ctx, void* obj, long long memPtr);
- bool IGNITE_CALL IgniteProcessorLoggerIsLevelEnabled(gcj::JniContext* ctx, void* obj, int level);
- void IGNITE_CALL IgniteProcessorLoggerLog(gcj::JniContext* ctx, void* obj, int level, char* message, char* category, char* errorInfo);
- void* IGNITE_CALL IgniteProcessorBinaryProcessor(gcj::JniContext* ctx, void* obj);
-
long long IGNITE_CALL IgniteTargetInLongOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/include/ignite/jni/java.h
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/include/ignite/jni/java.h b/modules/platforms/cpp/jni/include/ignite/jni/java.h
index f6d7207..c170a5b 100644
--- a/modules/platforms/cpp/jni/include/ignite/jni/java.h
+++ b/modules/platforms/cpp/jni/include/ignite/jni/java.h
@@ -175,32 +175,6 @@ namespace ignite
jclass c_PlatformProcessor;
jmethodID m_PlatformProcessor_releaseStart;
- jmethodID m_PlatformProcessor_cache;
- jmethodID m_PlatformProcessor_createCache;
- jmethodID m_PlatformProcessor_getOrCreateCache;
- jmethodID m_PlatformProcessor_createCacheFromConfig;
- jmethodID m_PlatformProcessor_getOrCreateCacheFromConfig;
- jmethodID m_PlatformProcessor_createNearCache;
- jmethodID m_PlatformProcessor_getOrCreateNearCache;
- jmethodID m_PlatformProcessor_destroyCache;
- jmethodID m_PlatformProcessor_affinity;
- jmethodID m_PlatformProcessor_dataStreamer;
- jmethodID m_PlatformProcessor_transactions;
- jmethodID m_PlatformProcessor_projection;
- jmethodID m_PlatformProcessor_compute;
- jmethodID m_PlatformProcessor_message;
- jmethodID m_PlatformProcessor_events;
- jmethodID m_PlatformProcessor_services;
- jmethodID m_PlatformProcessor_extensions;
- jmethodID m_PlatformProcessor_extension;
- jmethodID m_PlatformProcessor_atomicLong;
- jmethodID m_PlatformProcessor_getIgniteConfiguration;
- jmethodID m_PlatformProcessor_getCacheNames;
- jmethodID m_PlatformProcessor_atomicSequence;
- jmethodID m_PlatformProcessor_atomicReference;
- jmethodID m_PlatformProcessor_loggerIsLevelEnabled;
- jmethodID m_PlatformProcessor_loggerLog;
- jmethodID m_PlatformProcessor_binaryProcessor;
jclass c_PlatformTarget;
jmethodID m_PlatformTarget_inLongOutLong;
@@ -334,10 +308,8 @@ namespace ignite
static void SetConsoleHandler(ConsoleWriteHandler consoleHandler);
static int RemoveConsoleHandler(ConsoleWriteHandler consoleHandler);
- jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr);
- jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo);
- jobject IgnitionInstance(char* name);
- jobject IgnitionInstance(char* name, JniErrorInfo* errInfo);
+ void IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr);
+ void IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo);
long long IgnitionEnvironmentPointer(char* name);
long long IgnitionEnvironmentPointer(char* name, JniErrorInfo* errInfo);
bool IgnitionStop(char* name, bool cancel);
@@ -345,41 +317,6 @@ namespace ignite
void IgnitionStopAll(bool cancel);
void IgnitionStopAll(bool cancel, JniErrorInfo* errInfo);
- void ProcessorReleaseStart(jobject obj);
- jobject ProcessorProjection(jobject obj, JniErrorInfo* errInfo = NULL);
- jobject ProcessorCache(jobject obj, const char* name);
- jobject ProcessorCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorCreateCache(jobject obj, const char* name);
- jobject ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorGetOrCreateCache(jobject obj, const char* name);
- jobject ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorCreateCacheFromConfig(jobject obj, long long memPtr);
- jobject ProcessorCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo);
- jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr);
- jobject ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo);
- jobject ProcessorCreateNearCache(jobject obj, const char* name, long long memPtr);
- jobject ProcessorGetOrCreateNearCache(jobject obj, const char* name, long long memPtr);
- void ProcessorDestroyCache(jobject obj, const char* name);
- void ProcessorDestroyCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorAffinity(jobject obj, const char* name);
- jobject ProcessorDataStreamer(jobject obj, const char* name, bool keepPortable);
- jobject ProcessorTransactions(jobject obj, JniErrorInfo* errInfo = NULL);
- jobject ProcessorCompute(jobject obj, jobject prj);
- jobject ProcessorCompute(jobject obj, jobject prj, JniErrorInfo* errInfo);
- jobject ProcessorMessage(jobject obj, jobject prj);
- jobject ProcessorEvents(jobject obj, jobject prj);
- jobject ProcessorServices(jobject obj, jobject prj);
- jobject ProcessorExtensions(jobject obj);
- jobject ProcessorExtension(jobject obj, int id);
- jobject ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create);
- jobject ProcessorAtomicSequence(jobject obj, char* name, long long initVal, bool create);
- jobject ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create);
- void ProcessorGetIgniteConfiguration(jobject obj, long long memPtr);
- void ProcessorGetCacheNames(jobject obj, long long memPtr);
- bool ProcessorLoggerIsLevelEnabled(jobject obj, int level);
- void ProcessorLoggerLog(jobject obj, int level, char* message, char* category, char* errorInfo);
- jobject ProcessorBinaryProcessor(jobject obj);
-
long long TargetInLongOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
@@ -406,9 +343,6 @@ namespace ignite
void ExceptionCheck(JNIEnv* env);
void ExceptionCheck(JNIEnv* env, JniErrorInfo* errInfo);
jobject LocalToGlobal(JNIEnv* env, jobject obj);
- jobject ProcessorCache0(jobject proc, const char* name, jmethodID mthd, JniErrorInfo* errInfo);
- jobject ProcessorCacheFromConfig0(jobject proc, long long memPtr, jmethodID mthd, JniErrorInfo* errInfo);
- jobject ProcessorGetOrCreateNearCache0(jobject obj, const char* name, long long memPtr, jmethodID methodID);
};
JNIEXPORT jlong JNICALL JniCacheStoreCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/project/vs/module.def b/modules/platforms/cpp/jni/project/vs/module.def
index 82cc41e..53e7e42 100644
--- a/modules/platforms/cpp/jni/project/vs/module.def
+++ b/modules/platforms/cpp/jni/project/vs/module.def
@@ -2,19 +2,9 @@ LIBRARY ignite.jni.dll
EXPORTS
IgniteReallocate @1
IgniteIgnitionStart @2
-IgniteIgnitionInstance @3
IgniteIgnitionEnvironmentPointer @4
IgniteIgnitionStop @5
IgniteIgnitionStopAll @6
-IgniteProcessorReleaseStart @8
-IgniteProcessorProjection @9
-IgniteProcessorCache @10
-IgniteProcessorCreateCache @11
-IgniteProcessorGetOrCreateCache @12
-IgniteProcessorAffinity @13
-IgniteProcessorDataStreamer @14
-IgniteProcessorTransactions @15
-IgniteProcessorServices @16
IgniteTargetInStreamOutObject @17
IgniteTargetInStreamOutLong @18
IgniteTargetOutStream @19
@@ -22,9 +12,6 @@ IgniteTargetInStreamOutStream @20
IgniteTargetInObjectStreamOutObjectStream @21
IgniteTargetInLongOutLong @24
IgniteTargetInStreamAsync @25
-IgniteProcessorCompute @64
-IgniteProcessorMessage @65
-IgniteProcessorEvents @66
IgniteAcquire @80
IgniteRelease @81
IgniteThrowToJava @82
@@ -33,20 +20,5 @@ IgniteCreateContext @84
IgniteDeleteContext @85
IgniteDestroyJvm @86
IgniteTargetOutObject @91
-IgniteProcessorExtension @96
-IgniteProcessorExtensions @97
-IgniteProcessorAtomicLong @98
-IgniteProcessorCreateCacheFromConfig @114
-IgniteProcessorGetOrCreateCacheFromConfig @115
-IgniteProcessorGetIgniteConfiguration @116
-IgniteProcessorDestroyCache @117
-IgniteProcessorAtomicSequence @118
-IgniteProcessorAtomicReference @128
-IgniteProcessorCreateNearCache @131
-IgniteProcessorGetOrCreateNearCache @132
-IgniteProcessorGetCacheNames @133
IgniteSetConsoleHandler @135
-IgniteRemoveConsoleHandler @136
-IgniteProcessorLoggerIsLevelEnabled @137
-IgniteProcessorLoggerLog @138
-IgniteProcessorBinaryProcessor @139
\ No newline at end of file
+IgniteRemoveConsoleHandler @136
\ No newline at end of file
[13/19] ignite git commit: IGNITE-5770 Refactor PlatformProcessor to
PlatformTarget mechanism
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/exports.cpp b/modules/platforms/cpp/jni/src/exports.cpp
index 2aecd59..9b7defd 100644
--- a/modules/platforms/cpp/jni/src/exports.cpp
+++ b/modules/platforms/cpp/jni/src/exports.cpp
@@ -26,12 +26,8 @@ extern "C" {
return gcj::JniContext::Reallocate(memPtr, cap);
}
- void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) {
- return ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr);
- }
-
- void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name) {
- return ctx->IgnitionInstance(name);
+ void IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) {
+ ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr);
}
long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name) {
@@ -46,118 +42,10 @@ extern "C" {
return ctx->IgnitionStopAll(cancel);
}
- void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorReleaseStart(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorProjection(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorProjection(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorCreateCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorGetOrCreateCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) {
- return ctx->ProcessorCreateCacheFromConfig(static_cast<jobject>(obj), memPtr);
- }
-
- void* IGNITE_CALL IgniteProcessorGetOrCreateCacheFromConfig(gcj::JniContext* ctx, void* obj, long long memPtr) {
- return ctx->ProcessorGetOrCreateCacheFromConfig(static_cast<jobject>(obj), memPtr);
- }
-
- void* IGNITE_CALL IgniteProcessorCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr) {
- return ctx->ProcessorCreateNearCache(static_cast<jobject>(obj), name, memPtr);
- }
-
- void* IGNITE_CALL IgniteProcessorGetOrCreateNearCache(gcj::JniContext* ctx, void* obj, char* name, long long memPtr) {
- return ctx->ProcessorGetOrCreateNearCache(static_cast<jobject>(obj), name, memPtr);
- }
-
- void IGNITE_CALL IgniteProcessorDestroyCache(gcj::JniContext* ctx, void* obj, char* name) {
- ctx->ProcessorDestroyCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorAffinity(static_cast<jobject>(obj), name);
- }
-
- void*IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable) {
- return ctx->ProcessorDataStreamer(static_cast<jobject>(obj), name, keepPortable);
- }
-
- void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorTransactions(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorCompute(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorMessage(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorMessage(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorEvents(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorServices(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorExtensions(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorExtension(gcj::JniContext* ctx, void* obj, int id) {
- return ctx->ProcessorExtension(static_cast<jobject>(obj), id);
- }
-
- void* IGNITE_CALL IgniteProcessorAtomicLong(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create) {
- return ctx->ProcessorAtomicLong(static_cast<jobject>(obj), name, initVal, create);
- }
-
- void* IGNITE_CALL IgniteProcessorAtomicSequence(gcj::JniContext* ctx, void* obj, char* name, long long initVal, bool create) {
- return ctx->ProcessorAtomicSequence(static_cast<jobject>(obj), name, initVal, create);
- }
-
- void* IGNITE_CALL IgniteProcessorAtomicReference(gcj::JniContext* ctx, void* obj, char* name, long long memPtr, bool create) {
- return ctx->ProcessorAtomicReference(static_cast<jobject>(obj), name, memPtr, create);
- }
-
- void IGNITE_CALL IgniteProcessorGetIgniteConfiguration(gcj::JniContext* ctx, void* obj, long long memPtr) {
- return ctx->ProcessorGetIgniteConfiguration(static_cast<jobject>(obj), memPtr);
- }
-
- void IGNITE_CALL IgniteProcessorGetCacheNames(gcj::JniContext* ctx, void* obj, long long memPtr) {
- return ctx->ProcessorGetCacheNames(static_cast<jobject>(obj), memPtr);
- }
-
long long IGNITE_CALL IgniteTargetInLongOutLong(gcj::JniContext* ctx, void* obj, int opType, long long val) {
return ctx->TargetInLongOutLong(static_cast<jobject>(obj), opType, val);
}
- bool IGNITE_CALL IgniteProcessorLoggerIsLevelEnabled(gcj::JniContext* ctx, void* obj, int level) {
- return ctx->ProcessorLoggerIsLevelEnabled(static_cast<jobject>(obj), level);
- }
-
- void IGNITE_CALL IgniteProcessorLoggerLog(gcj::JniContext* ctx, void* obj, int level, char* message, char* category, char* errorInfo) {
- ctx->ProcessorLoggerLog(static_cast<jobject>(obj), level, message, category, errorInfo);
- }
-
- void* IGNITE_CALL IgniteProcessorBinaryProcessor(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorBinaryProcessor(static_cast<jobject>(obj));
- }
-
long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
return ctx->TargetInStreamOutLong(static_cast<jobject>(obj), opType, memPtr);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/cpp/jni/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/jni/src/java.cpp b/modules/platforms/cpp/jni/src/java.cpp
index bc6af34..7eadec0 100644
--- a/modules/platforms/cpp/jni/src/java.cpp
+++ b/modules/platforms/cpp/jni/src/java.cpp
@@ -223,32 +223,6 @@ namespace ignite
const char* C_PLATFORM_PROCESSOR = "org/apache/ignite/internal/processors/platform/PlatformProcessor";
JniMethod M_PLATFORM_PROCESSOR_RELEASE_START = JniMethod("releaseStart", "()V", false);
- JniMethod M_PLATFORM_PROCESSOR_PROJECTION = JniMethod("projection", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_CACHE = JniMethod("cache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_CREATE_CACHE = JniMethod("createCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE = JniMethod("getOrCreateCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_CREATE_CACHE_FROM_CONFIG = JniMethod("createCacheFromConfig", "(J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE_FROM_CONFIG = JniMethod("getOrCreateCacheFromConfig", "(J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_CREATE_NEAR_CACHE = JniMethod("createNearCache", "(Ljava/lang/String;J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_NEAR_CACHE = JniMethod("getOrCreateNearCache", "(Ljava/lang/String;J)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_DESTROY_CACHE = JniMethod("destroyCache", "(Ljava/lang/String;)V", false);
- JniMethod M_PLATFORM_PROCESSOR_AFFINITY = JniMethod("affinity", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_DATA_STREAMER = JniMethod("dataStreamer", "(Ljava/lang/String;Z)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_TRANSACTIONS = JniMethod("transactions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_COMPUTE = JniMethod("compute", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_MESSAGE = JniMethod("message", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_EVENTS = JniMethod("events", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_SERVICES = JniMethod("services", "(Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_EXTENSIONS = JniMethod("extensions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_EXTENSION = JniMethod("extension", "(I)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_ATOMIC_LONG = JniMethod("atomicLong", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE = JniMethod("atomicSequence", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE = JniMethod("atomicReference", "(Ljava/lang/String;JZ)Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION = JniMethod("getIgniteConfiguration", "(J)V", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_CACHE_NAMES = JniMethod("getCacheNames", "(J)V", false);
- JniMethod M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(I)Z", false);
- JniMethod M_PLATFORM_PROCESSOR_LOGGER_LOG = JniMethod("loggerLog", "(ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", false);
- JniMethod M_PLATFORM_PROCESSOR_BINARY_PROCESSOR = JniMethod("binaryProcessor", "()Lorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;", false);
const char* C_PLATFORM_TARGET = "org/apache/ignite/internal/processors/platform/PlatformTargetProxy";
JniMethod M_PLATFORM_TARGET_IN_LONG_OUT_LONG = JniMethod("inLongOutLong", "(IJ)J", false);
@@ -262,86 +236,9 @@ namespace ignite
const char* C_PLATFORM_CALLBACK_UTILS = "org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils";
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_CREATE = JniMethod("cacheStoreCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_INVOKE = JniMethod("cacheStoreInvoke", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_DESTROY = JniMethod("cacheStoreDestroy", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_SESSION_CREATE = JniMethod("cacheStoreSessionCreate", "(JJ)J", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_CREATE = JniMethod("cacheEntryFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_APPLY = JniMethod("cacheEntryFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_DESTROY = JniMethod("cacheEntryFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_INVOKE = JniMethod("cacheInvoke", "(JJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_MAP = JniMethod("computeTaskMap", "(JJJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_JOB_RESULT = JniMethod("computeTaskJobResult", "(JJJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_REDUCE = JniMethod("computeTaskReduce", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_COMPLETE = JniMethod("computeTaskComplete", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_SERIALIZE = JniMethod("computeJobSerialize", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CREATE = JniMethod("computeJobCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_EXECUTE = JniMethod("computeJobExecute", "(JJIJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_DESTROY = JniMethod("computeJobDestroy", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CANCEL = JniMethod("computeJobCancel", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_LSNR_APPLY = JniMethod("continuousQueryListenerApply", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_CREATE = JniMethod("continuousQueryFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_EVAL = JniMethod("continuousQueryFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_RELEASE = JniMethod("continuousQueryFilterRelease", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_TOPOLOGY_UPDATE = JniMethod("dataStreamerTopologyUpdate", "(JJJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_STREAM_RECEIVER_INVOKE = JniMethod("dataStreamerStreamReceiverInvoke", "(JJLorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;JZ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BYTE_RES = JniMethod("futureByteResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BOOL_RES = JniMethod("futureBoolResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_SHORT_RES = JniMethod("futureShortResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_CHAR_RES = JniMethod("futureCharResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_INT_RES = JniMethod("futureIntResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_FLOAT_RES = JniMethod("futureFloatResult", "(JJF)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_LONG_RES = JniMethod("futureLongResult", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_DOUBLE_RES = JniMethod("futureDoubleResult", "(JJD)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_OBJ_RES = JniMethod("futureObjectResult", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_NULL_RES = JniMethod("futureNullResult", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_ERR = JniMethod("futureError", "(JJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_LIFECYCLE_EVENT = JniMethod("lifecycleEvent", "(JJI)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_CREATE = JniMethod("messagingFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_APPLY = JniMethod("messagingFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_DESTROY = JniMethod("messagingFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_CREATE = JniMethod("eventFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_APPLY = JniMethod("eventFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_DESTROY = JniMethod("eventFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INIT = JniMethod("serviceInit", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_EXECUTE = JniMethod("serviceExecute", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_CANCEL = JniMethod("serviceCancel", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INVOKE_METHOD = JniMethod("serviceInvokeMethod", "(JJJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CLUSTER_NODE_FILTER_APPLY = JniMethod("clusterNodeFilterApply", "(JJ)I", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_NODE_INFO = JniMethod("nodeInfo", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_MEMORY_REALLOCATE = JniMethod("memoryReallocate", "(JJI)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_START = JniMethod("onStart", "(JLjava/lang/Object;J)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_STOP = JniMethod("onStop", "(J)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG = JniMethod("extensionCallbackInLongOutLong", "(JIJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG = JniMethod("extensionCallbackInLongLongOutLong", "(JIJJ)J", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_DISCONNECTED = JniMethod("onClientDisconnected", "(J)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_CLIENT_RECONNECTED = JniMethod("onClientReconnected", "(JZ)V", true);
-
JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_LOG = JniMethod("loggerLog", "(JILjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_LOGGER_IS_LEVEL_ENABLED = JniMethod("loggerIsLevelEnabled", "(JI)Z", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_INIT = JniMethod("affinityFunctionInit", "(JJLorg/apache/ignite/internal/processors/platform/PlatformTargetProxy;)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_PARTITION = JniMethod("affinityFunctionPartition", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_ASSIGN_PARTITIONS = JniMethod("affinityFunctionAssignPartitions", "(JJJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_REMOVE_NODE = JniMethod("affinityFunctionRemoveNode", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_AFFINITY_FUNCTION_DESTROY = JniMethod("affinityFunctionDestroy", "(JJ)V", true);
-
JniMethod M_PLATFORM_CALLBACK_UTILS_CONSOLE_WRITE = JniMethod("consoleWrite", "(Ljava/lang/String;Z)V", true);
JniMethod M_PLATFORM_CALLBACK_UTILS_IN_LONG_OUT_LONG = JniMethod("inLongOutLong", "(JIJ)J", true);
@@ -353,7 +250,7 @@ namespace ignite
JniMethod M_PLATFORM_UTILS_GET_FULL_STACK_TRACE = JniMethod("getFullStackTrace", "(Ljava/lang/Throwable;)Ljava/lang/String;", true);
const char* C_PLATFORM_IGNITION = "org/apache/ignite/internal/processors/platform/PlatformIgnition";
- JniMethod M_PLATFORM_IGNITION_START = JniMethod("start", "(Ljava/lang/String;Ljava/lang/String;IJJ)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true);
+ JniMethod M_PLATFORM_IGNITION_START = JniMethod("start", "(Ljava/lang/String;Ljava/lang/String;IJJ)V", true);
JniMethod M_PLATFORM_IGNITION_INSTANCE = JniMethod("instance", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true);
JniMethod M_PLATFORM_IGNITION_ENVIRONMENT_POINTER = JniMethod("environmentPointer", "(Ljava/lang/String;)J", true);
JniMethod M_PLATFORM_IGNITION_STOP = JniMethod("stop", "(Ljava/lang/String;Z)Z", true);
@@ -554,32 +451,6 @@ namespace ignite
c_PlatformProcessor = FindClass(env, C_PLATFORM_PROCESSOR);
m_PlatformProcessor_releaseStart = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_RELEASE_START);
- m_PlatformProcessor_cache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CACHE);
- m_PlatformProcessor_createCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_CACHE);
- m_PlatformProcessor_getOrCreateCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE);
- m_PlatformProcessor_createCacheFromConfig = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_CACHE_FROM_CONFIG);
- m_PlatformProcessor_getOrCreateCacheFromConfig = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE_FROM_CONFIG);
- m_PlatformProcessor_createNearCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_NEAR_CACHE);
- m_PlatformProcessor_getOrCreateNearCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_NEAR_CACHE);
- m_PlatformProcessor_destroyCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_DESTROY_CACHE);
- m_PlatformProcessor_affinity = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_AFFINITY);
- m_PlatformProcessor_dataStreamer = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_DATA_STREAMER);
- m_PlatformProcessor_transactions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_TRANSACTIONS);
- m_PlatformProcessor_projection = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_PROJECTION);
- m_PlatformProcessor_compute = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_COMPUTE);
- m_PlatformProcessor_message = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_MESSAGE);
- m_PlatformProcessor_events = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EVENTS);
- m_PlatformProcessor_services = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_SERVICES);
- m_PlatformProcessor_extensions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSIONS);
- m_PlatformProcessor_extension = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSION);
- m_PlatformProcessor_atomicLong = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_LONG);
- m_PlatformProcessor_atomicSequence = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_SEQUENCE);
- m_PlatformProcessor_atomicReference = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_ATOMIC_REFERENCE);
- m_PlatformProcessor_getIgniteConfiguration = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_IGNITE_CONFIGURATION);
- m_PlatformProcessor_getCacheNames = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_CACHE_NAMES);
- m_PlatformProcessor_loggerIsLevelEnabled = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_IS_LEVEL_ENABLED);
- m_PlatformProcessor_loggerLog = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_LOGGER_LOG);
- m_PlatformProcessor_binaryProcessor = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_BINARY_PROCESSOR);
c_PlatformTarget = FindClass(env, C_PLATFORM_TARGET);
m_PlatformTarget_inLongOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_LONG_OUT_LONG);
@@ -871,18 +742,18 @@ namespace ignite
}
}
- jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) {
+ void JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) {
return IgnitionStart(cfgPath, name, factoryId, dataPtr, NULL);
}
- jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo)
+ void JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo)
{
JNIEnv* env = Attach();
jstring cfgPath0 = env->NewStringUTF(cfgPath);
jstring name0 = env->NewStringUTF(name);
- jobject interop = env->CallStaticObjectMethod(
+ env->CallStaticVoidMethod(
jvm->GetMembers().c_PlatformIgnition,
jvm->GetMembers().m_PlatformIgnition_start,
cfgPath0,
@@ -893,30 +764,8 @@ namespace ignite
);
ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, interop);
- }
-
-
- jobject JniContext::IgnitionInstance(char* name)
- {
- return IgnitionInstance(name, NULL);
- }
-
- jobject JniContext::IgnitionInstance(char* name, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = env->NewStringUTF(name);
-
- jobject interop = env->CallStaticObjectMethod(jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_instance, name0);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, interop);
}
-
+
long long JniContext::IgnitionEnvironmentPointer(char* name)
{
return IgnitionEnvironmentPointer(name, NULL);
@@ -970,318 +819,6 @@ namespace ignite
ExceptionCheck(env, errInfo);
}
- void JniContext::ProcessorReleaseStart(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_releaseStart);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::ProcessorProjection(jobject obj, JniErrorInfo* errInfo) {
- JNIEnv* env = Attach();
-
- jobject prj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_projection);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, prj);
- }
-
- jobject JniContext::ProcessorCache0(jobject obj, const char* name, jmethodID mthd, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject cache = env->CallObjectMethod(obj, mthd, name0);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::ProcessorCacheFromConfig0(jobject obj, long long memPtr, jmethodID mthd, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, mthd, memPtr);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::ProcessorCache(jobject obj, const char* name) {
- return ProcessorCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorCache(jobject obj, const char* name, JniErrorInfo* errInfo) {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_cache, errInfo);
- }
-
- jobject JniContext::ProcessorCreateCache(jobject obj, const char* name) {
- return ProcessorCreateCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo)
- {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_createCache, errInfo);
- }
-
- jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name) {
- return ProcessorGetOrCreateCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo)
- {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_getOrCreateCache, errInfo);
- }
-
- void JniContext::ProcessorDestroyCache(jobject obj, const char* name) {
- ProcessorDestroyCache(obj, name, NULL);
- }
-
- void JniContext::ProcessorDestroyCache(jobject obj, const char* name, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_destroyCache, name0);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env, errInfo);
- }
-
- jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr) {
- return ProcessorCreateCacheFromConfig(obj, memPtr, NULL);
- }
-
- jobject JniContext::ProcessorCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo)
- {
- return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_createCacheFromConfig, errInfo);
- }
-
- jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr) {
- return ProcessorGetOrCreateCacheFromConfig(obj, memPtr, NULL);
- }
-
- jobject JniContext::ProcessorGetOrCreateCacheFromConfig(jobject obj, long long memPtr, JniErrorInfo* errInfo)
- {
- return ProcessorCacheFromConfig0(obj, memPtr, jvm->GetMembers().m_PlatformProcessor_getOrCreateCacheFromConfig, errInfo);
- }
-
- jobject JniContext::ProcessorCreateNearCache(jobject obj, const char* name, long long memPtr)
- {
- return ProcessorGetOrCreateNearCache0(obj, name, memPtr, jvm->GetMembers().m_PlatformProcessor_createNearCache);
- }
-
- jobject JniContext::ProcessorGetOrCreateNearCache(jobject obj, const char* name, long long memPtr)
- {
- return ProcessorGetOrCreateNearCache0(obj, name, memPtr, jvm->GetMembers().m_PlatformProcessor_getOrCreateNearCache);
- }
-
- jobject JniContext::ProcessorGetOrCreateNearCache0(jobject obj, const char* name, long long memPtr, jmethodID methodID)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject cache = env->CallObjectMethod(obj, methodID, name0, memPtr);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::ProcessorAffinity(jobject obj, const char* name) {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject aff = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_affinity, name0);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, aff);
- }
-
- jobject JniContext::ProcessorDataStreamer(jobject obj, const char* name, bool keepPortable) {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject ldr = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_dataStreamer, name0,
- keepPortable);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, ldr);
- }
-
- jobject JniContext::ProcessorTransactions(jobject obj, JniErrorInfo* errInfo) {
- JNIEnv* env = Attach();
-
- jobject tx = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_transactions);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, tx);
- }
-
- jobject JniContext::ProcessorCompute(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_compute, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorCompute(jobject obj, jobject prj, JniErrorInfo* errInfo) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_compute, prj);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorMessage(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_message, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorEvents(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_events, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorServices(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_services, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorExtensions(jobject obj)
- {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extensions);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorExtension(jobject obj, int id)
- {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extension, id);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorAtomicLong(jobject obj, char* name, long long initVal, bool create)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicLong, name0, initVal, create);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorAtomicSequence(jobject obj, char* name, long long initVal, bool create)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicSequence, name0, initVal, create);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorAtomicReference(jobject obj, char* name, long long memPtr, bool create)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_atomicReference, name0, memPtr, create);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- void JniContext::ProcessorGetIgniteConfiguration(jobject obj, long long memPtr)
- {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_getIgniteConfiguration, memPtr);
-
- ExceptionCheck(env);
- }
-
- void JniContext::ProcessorGetCacheNames(jobject obj, long long memPtr)
- {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_getCacheNames, memPtr);
-
- ExceptionCheck(env);
- }
-
long long JniContext::TargetInLongOutLong(jobject obj, int opType, long long val, JniErrorInfo* err) {
JNIEnv* env = Attach();
@@ -1292,51 +829,6 @@ namespace ignite
return res;
}
- bool JniContext::ProcessorLoggerIsLevelEnabled(jobject obj, int level)
- {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerIsLevelEnabled, level);
-
- ExceptionCheck(env);
-
- return res != 0;
- }
-
- void JniContext::ProcessorLoggerLog(jobject obj, int level, char* message, char* category, char* errorInfo)
- {
- JNIEnv* env = Attach();
-
- jstring message0 = message != NULL ? env->NewStringUTF(message) : NULL;
- jstring category0 = category != NULL ? env->NewStringUTF(category) : NULL;
- jstring errorInfo0 = errorInfo != NULL ? env->NewStringUTF(errorInfo) : NULL;
-
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_loggerLog, level, message0, category0, errorInfo0);
-
- if (message0)
- env->DeleteLocalRef(message0);
-
- if (category0)
- env->DeleteLocalRef(category0);
-
- if (errorInfo0)
- env->DeleteLocalRef(errorInfo0);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::ProcessorBinaryProcessor(jobject obj)
- {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_binaryProcessor);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
long long JniContext::TargetInStreamOutLong(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
JNIEnv* env = Attach();
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
index c5d056d..44ebef3 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Ignition.cs
@@ -253,7 +253,9 @@ namespace Apache.Ignite.Core
var javaLogger = log as JavaLogger;
if (javaLogger != null)
- javaLogger.SetProcessor(interopProc);
+ {
+ javaLogger.SetIgnite(node);
+ }
// 6. On-start callback (notify lifecycle components).
node.OnStart();
@@ -291,10 +293,14 @@ namespace Apache.Ignite.Core
}
finally
{
+ var ignite = _startup.Ignite;
+
_startup = null;
- if (interopProc != null)
- UU.ProcessorReleaseStart(interopProc);
+ if (ignite != null)
+ {
+ ignite.ProcessorReleaseStart();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index b1bf5eb..e6b2408 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -1166,7 +1166,7 @@ namespace Apache.Ignite.Core.Impl.Cache
{
if (loc)
{
- var target = DoOutOpObject((int) CacheOp.LocIterator, w => w.WriteInt(peekModes));
+ var target = DoOutOpObject((int) CacheOp.LocIterator, (IBinaryStream s) => s.WriteInt(peekModes));
return new CacheEnumerator<TK, TV>(target, Marshaller, _flagKeepBinary);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
index 6e07b78..30afe57 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
@@ -135,6 +135,18 @@ namespace Apache.Ignite.Core.Impl.Cluster
/** */
private const int OpGetPersistentStoreMetrics = 30;
+ /** */
+ private const int OpGetCompute = 31;
+
+ /** */
+ private const int OpGetMessaging = 32;
+
+ /** */
+ private const int OpGetEvents = 33;
+
+ /** */
+ private const int OpGetServices = 34;
+
/** Initial Ignite instance. */
private readonly Ignite _ignite;
@@ -147,17 +159,14 @@ namespace Apache.Ignite.Core.Impl.Cluster
/** Nodes for the given topology version. */
private volatile IList<IClusterNode> _nodes;
- /** Processor. */
- private readonly IUnmanagedTarget _proc;
-
/** Compute. */
- private readonly Lazy<Compute> _comp;
+ private readonly Lazy<ICompute> _comp;
/** Messaging. */
- private readonly Lazy<Messaging> _msg;
+ private readonly Lazy<IMessaging> _msg;
/** Events. */
- private readonly Lazy<Events> _events;
+ private readonly Lazy<IEvents> _events;
/** Services. */
private readonly Lazy<IServices> _services;
@@ -165,29 +174,20 @@ namespace Apache.Ignite.Core.Impl.Cluster
/// <summary>
/// Constructor.
/// </summary>
- /// <param name="proc">Processor.</param>
/// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
/// <param name="ignite">Grid.</param>
/// <param name="pred">Predicate.</param>
[SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily")]
- public ClusterGroupImpl(IUnmanagedTarget proc, IUnmanagedTarget target, Marshaller marsh,
- Ignite ignite, Func<IClusterNode, bool> pred)
- : base(target, marsh)
+ public ClusterGroupImpl(IUnmanagedTarget target, Ignite ignite, Func<IClusterNode, bool> pred)
+ : base(target, ignite.Marshaller)
{
- _proc = proc;
_ignite = ignite;
_pred = pred;
- _comp = new Lazy<Compute>(() =>
- new Compute(new ComputeImpl(UU.ProcessorCompute(proc, target), marsh, this, false)));
-
- _msg = new Lazy<Messaging>(() => new Messaging(UU.ProcessorMessage(proc, target), marsh, this));
-
- _events = new Lazy<Events>(() => new Events(UU.ProcessorEvents(proc, target), marsh, this));
-
- _services = new Lazy<IServices>(() =>
- new Services(UU.ProcessorServices(proc, target), marsh, this, false, false));
+ _comp = new Lazy<ICompute>(() => CreateCompute());
+ _msg = new Lazy<IMessaging>(() => CreateMessaging());
+ _events = new Lazy<IEvents>(() => CreateEvents());
+ _services = new Lazy<IServices>(() => CreateServices());
}
/** <inheritDoc /> */
@@ -202,6 +202,14 @@ namespace Apache.Ignite.Core.Impl.Cluster
return _comp.Value;
}
+ /// <summary>
+ /// Creates the compute.
+ /// </summary>
+ private ICompute CreateCompute()
+ {
+ return new Compute(new ComputeImpl(DoOutOpObject(OpGetCompute), Marshaller, this, false));
+ }
+
/** <inheritDoc /> */
public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes)
{
@@ -257,7 +265,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
{
var newPred = _pred == null ? p : node => _pred(node) && p(node);
- return new ClusterGroupImpl(_proc, Target, Marshaller, _ignite, newPred);
+ return new ClusterGroupImpl(Target, _ignite, newPred);
}
/** <inheritDoc /> */
@@ -413,12 +421,28 @@ namespace Apache.Ignite.Core.Impl.Cluster
return _msg.Value;
}
+ /// <summary>
+ /// Creates the messaging.
+ /// </summary>
+ private IMessaging CreateMessaging()
+ {
+ return new Messaging(DoOutOpObject(OpGetMessaging), Marshaller, this);
+ }
+
/** <inheritDoc /> */
public IEvents GetEvents()
{
return _events.Value;
}
+ /// <summary>
+ /// Creates the events.
+ /// </summary>
+ private IEvents CreateEvents()
+ {
+ return new Events(DoOutOpObject(OpGetEvents), Marshaller, this);
+ }
+
/** <inheritDoc /> */
public IServices GetServices()
{
@@ -426,6 +450,14 @@ namespace Apache.Ignite.Core.Impl.Cluster
}
/// <summary>
+ /// Creates the services.
+ /// </summary>
+ private IServices CreateServices()
+ {
+ return new Services(DoOutOpObject(OpGetServices), Marshaller, this, false, false);
+ }
+
+ /// <summary>
/// Pings a remote node.
/// </summary>
/// <param name="nodeId">ID of a node to ping.</param>
@@ -635,7 +667,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
/// <returns>New cluster group.</returns>
private IClusterGroup GetClusterGroup(IUnmanagedTarget prj)
{
- return new ClusterGroupImpl(_proc, prj, Marshaller, _ignite, _pred);
+ return new ClusterGroupImpl(prj, _ignite, _pred);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
index 7a028cd..cace7b2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
@@ -186,10 +186,10 @@ namespace Apache.Ignite.Core.Impl.Compute
long ptr = Marshaller.Ignite.HandleRegistry.Allocate(holder);
- var futTarget = DoOutOpObject(OpExecNative, w =>
+ var futTarget = DoOutOpObject(OpExecNative, (IBinaryStream s) =>
{
- w.WriteLong(ptr);
- w.WriteLong(_prj.TopologyVersion);
+ s.WriteLong(ptr);
+ s.WriteLong(_prj.TopologyVersion);
});
var future = holder.Future;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
index b9e3030..96e58d4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
@@ -547,8 +547,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
return result;
}
- return new DataStreamerImpl<TK1, TV1>(UU.ProcessorDataStreamer(Marshaller.Ignite.InteropProcessor,
- _cacheName, true), Marshaller, _cacheName, true);
+ return Marshaller.Ignite.GetDataStreamer<TK1, TV1>(_cacheName, true);
}
/** <inheritDoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
index 953ddb6..c91334d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
@@ -138,7 +138,7 @@ namespace Apache.Ignite.Core.Impl.Datastream
for (var i = 0; i < size; i++)
entries.Add(new CacheEntry<TK, TV>(reader.ReadObject<TK>(), reader.ReadObject<TV>()));
- receiver.Receive(grid.Cache<TK, TV>(cache, keepBinary), entries);
+ receiver.Receive(grid.GetCache<TK, TV>(cache, keepBinary), entries);
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
index 205f6e2..715776e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
@@ -42,6 +42,7 @@ namespace Apache.Ignite.Core.Impl
using Apache.Ignite.Core.Impl.Plugin;
using Apache.Ignite.Core.Impl.Transactions;
using Apache.Ignite.Core.Impl.Unmanaged;
+ using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Lifecycle;
using Apache.Ignite.Core.Log;
using Apache.Ignite.Core.Messaging;
@@ -53,8 +54,37 @@ namespace Apache.Ignite.Core.Impl
/// <summary>
/// Native Ignite wrapper.
/// </summary>
- internal class Ignite : IIgnite, ICluster
+ internal class Ignite : PlatformTarget, IIgnite, ICluster
{
+ /// <summary>
+ /// Operation codes for PlatformProcessorImpl calls.
+ /// </summary>
+ private enum Op
+ {
+ GetCache = 1,
+ CreateCache = 2,
+ GetOrCreateCache = 3,
+ CreateCacheFromConfig = 4,
+ GetOrCreateCacheFromConfig = 5,
+ DestroyCache = 6,
+ GetAffinity = 7,
+ GetDataStreamer = 8,
+ GetTransactions = 9,
+ GetClusterGroup = 10,
+ GetExtension = 11,
+ GetAtomicLong = 12,
+ GetAtomicReference = 13,
+ GetAtomicSequence = 14,
+ GetIgniteConfiguration = 15,
+ GetCacheNames = 16,
+ CreateNearCache = 17,
+ GetOrCreateNearCache = 18,
+ LoggerIsLevelEnabled = 19,
+ LoggerLog = 20,
+ GetBinaryProcessor = 21,
+ ReleaseStart = 22
+ }
+
/** */
private readonly IgniteConfiguration _cfg;
@@ -109,7 +139,7 @@ namespace Apache.Ignite.Core.Impl
/// <param name="lifecycleHandlers">Lifecycle beans.</param>
/// <param name="cbs">Callbacks.</param>
public Ignite(IgniteConfiguration cfg, string name, IUnmanagedTarget proc, Marshaller marsh,
- IList<LifecycleHandlerHolder> lifecycleHandlers, UnmanagedCallbacks cbs)
+ IList<LifecycleHandlerHolder> lifecycleHandlers, UnmanagedCallbacks cbs) : base(proc, marsh)
{
Debug.Assert(cfg != null);
Debug.Assert(proc != null);
@@ -126,17 +156,17 @@ namespace Apache.Ignite.Core.Impl
marsh.Ignite = this;
- _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null);
+ _prj = new ClusterGroupImpl(DoOutOpObject((int) Op.GetClusterGroup), this, null);
_binary = new Binary.Binary(marsh);
- _binaryProc = new BinaryProcessor(UU.ProcessorBinaryProcessor(proc), marsh);
+ _binaryProc = new BinaryProcessor(DoOutOpObject((int) Op.GetBinaryProcessor), marsh);
cbs.Initialize(this);
// Grid is not completely started here, can't initialize interop transactions right away.
_transactions = new Lazy<TransactionsImpl>(
- () => new TransactionsImpl(UU.ProcessorTransactions(proc), marsh, GetLocalNode().Id));
+ () => new TransactionsImpl(DoOutOpObject((int) Op.GetTransactions), marsh, GetLocalNode().Id));
// Set reconnected task to completed state for convenience.
_clientReconnectTaskCompletionSource.SetResult(false);
@@ -207,7 +237,7 @@ namespace Apache.Ignite.Core.Impl
/** <inheritdoc /> */
public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes)
{
- return ((IClusterGroup) _prj).ForNodes(nodes);
+ return _prj.ForNodes(nodes);
}
/** <inheritdoc /> */
@@ -219,12 +249,6 @@ namespace Apache.Ignite.Core.Impl
/** <inheritdoc /> */
public IClusterGroup ForNodeIds(IEnumerable<Guid> ids)
{
- return ((IClusterGroup) _prj).ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(ICollection<Guid> ids)
- {
return _prj.ForNodeIds(ids);
}
@@ -389,7 +413,8 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(name, "name");
- return Cache<TK, TV>(UU.ProcessorCache(_proc, name));
+
+ return GetCache<TK, TV>(DoOutOpObject((int) Op.GetCache, w => w.WriteString(name)));
}
/** <inheritdoc /> */
@@ -397,7 +422,7 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(name, "name");
- return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, name));
+ return GetCache<TK, TV>(DoOutOpObject((int) Op.GetOrCreateCache, w => w.WriteString(name)));
}
/** <inheritdoc /> */
@@ -407,31 +432,10 @@ namespace Apache.Ignite.Core.Impl
}
/** <inheritdoc /> */
- public ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration,
+ public ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration,
NearCacheConfiguration nearConfiguration)
{
- IgniteArgumentCheck.NotNull(configuration, "configuration");
- IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
- configuration.Validate(Logger);
-
- using (var stream = IgniteManager.Memory.Allocate().GetStream())
- {
- var writer = BinaryUtils.Marshaller.StartMarshal(stream);
-
- configuration.Write(writer);
-
- if (nearConfiguration != null)
- {
- writer.WriteBoolean(true);
- nearConfiguration.Write(writer);
- }
- else
- writer.WriteBoolean(false);
-
- stream.SynchronizeOutput();
-
- return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, stream.MemoryPointer));
- }
+ return GetOrCreateCache<TK, TV>(configuration, nearConfiguration, Op.GetOrCreateCacheFromConfig);
}
/** <inheritdoc /> */
@@ -439,7 +443,9 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(name, "name");
- return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, name));
+ var cacheTarget = DoOutOpObject((int) Op.CreateCache, w => w.WriteString(name));
+
+ return GetCache<TK, TV>(cacheTarget);
}
/** <inheritdoc /> */
@@ -452,29 +458,37 @@ namespace Apache.Ignite.Core.Impl
public ICache<TK, TV> CreateCache<TK, TV>(CacheConfiguration configuration,
NearCacheConfiguration nearConfiguration)
{
+ return GetOrCreateCache<TK, TV>(configuration, nearConfiguration, Op.CreateCacheFromConfig);
+ }
+
+ /// <summary>
+ /// Gets or creates the cache.
+ /// </summary>
+ private ICache<TK, TV> GetOrCreateCache<TK, TV>(CacheConfiguration configuration,
+ NearCacheConfiguration nearConfiguration, Op op)
+ {
IgniteArgumentCheck.NotNull(configuration, "configuration");
IgniteArgumentCheck.NotNull(configuration.Name, "CacheConfiguration.Name");
configuration.Validate(Logger);
- using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ var cacheTarget = DoOutOpObject((int) op, s =>
{
- // Use system marshaller: full footers, always unregistered mode.
- var writer = BinaryUtils.Marshaller.StartMarshal(stream);
+ var w = BinaryUtils.Marshaller.StartMarshal(s);
- configuration.Write(writer);
+ configuration.Write(w);
if (nearConfiguration != null)
{
- writer.WriteBoolean(true);
- nearConfiguration.Write(writer);
+ w.WriteBoolean(true);
+ nearConfiguration.Write(w);
}
else
- writer.WriteBoolean(false);
-
- stream.SynchronizeOutput();
+ {
+ w.WriteBoolean(false);
+ }
+ });
- return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, stream.MemoryPointer));
- }
+ return GetCache<TK, TV>(cacheTarget);
}
/** <inheritdoc /> */
@@ -482,7 +496,7 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(name, "name");
- UU.ProcessorDestroyCache(_proc, name);
+ DoOutOp((int) Op.DestroyCache, w => w.WriteString(name));
}
/// <summary>
@@ -493,7 +507,7 @@ namespace Apache.Ignite.Core.Impl
/// <returns>
/// New instance of cache wrapping specified native cache.
/// </returns>
- public ICache<TK, TV> Cache<TK, TV>(IUnmanagedTarget nativeCache, bool keepBinary = false)
+ public ICache<TK, TV> GetCache<TK, TV>(IUnmanagedTarget nativeCache, bool keepBinary = false)
{
return new CacheImpl<TK, TV>(this, nativeCache, _marsh, false, keepBinary, false, false);
}
@@ -541,8 +555,21 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(cacheName, "cacheName");
- return new DataStreamerImpl<TK, TV>(UU.ProcessorDataStreamer(_proc, cacheName, false),
- _marsh, cacheName, false);
+ return GetDataStreamer<TK, TV>(cacheName, false);
+ }
+
+ /// <summary>
+ /// Gets the data streamer.
+ /// </summary>
+ internal IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName, bool keepBinary)
+ {
+ var streamerTarget = DoOutOpObject((int) Op.GetDataStreamer, w =>
+ {
+ w.WriteString(cacheName);
+ w.WriteBoolean(keepBinary);
+ });
+
+ return new DataStreamerImpl<TK, TV>(streamerTarget, _marsh, cacheName, keepBinary);
}
/** <inheritdoc /> */
@@ -556,11 +583,12 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNull(cacheName, "cacheName");
- return new CacheAffinityImpl(UU.ProcessorAffinity(_proc, cacheName), _marsh, false, this);
+ var aff = DoOutOpObject((int) Op.GetAffinity, w => w.WriteString(cacheName));
+
+ return new CacheAffinityImpl(aff, _marsh, false, this);
}
/** <inheritdoc /> */
-
public ITransactions GetTransactions()
{
return _transactions.Value;
@@ -589,7 +617,12 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- var nativeLong = UU.ProcessorAtomicLong(_proc, name, initialValue, create);
+ var nativeLong = DoOutOpObject((int) Op.GetAtomicLong, w =>
+ {
+ w.WriteString(name);
+ w.WriteLong(initialValue);
+ w.WriteBoolean(create);
+ });
if (nativeLong == null)
return null;
@@ -602,7 +635,12 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- var nativeSeq = UU.ProcessorAtomicSequence(_proc, name, initialValue, create);
+ var nativeSeq = DoOutOpObject((int) Op.GetAtomicSequence, w =>
+ {
+ w.WriteString(name);
+ w.WriteLong(initialValue);
+ w.WriteBoolean(create);
+ });
if (nativeSeq == null)
return null;
@@ -615,81 +653,47 @@ namespace Apache.Ignite.Core.Impl
{
IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- var refTarget = GetAtomicReferenceUnmanaged(name, initialValue, create);
-
- return refTarget == null ? null : new AtomicReference<T>(refTarget, Marshaller, name);
- }
-
- /// <summary>
- /// Gets the unmanaged atomic reference.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="initialValue">The initial value.</param>
- /// <param name="create">Create flag.</param>
- /// <returns>Unmanaged atomic reference, or null.</returns>
- private IUnmanagedTarget GetAtomicReferenceUnmanaged<T>(string name, T initialValue, bool create)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
-
- // Do not allocate memory when default is not used.
- if (!create)
- return UU.ProcessorAtomicReference(_proc, name, 0, false);
-
- using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ var refTarget = DoOutOpObject((int) Op.GetAtomicReference, w =>
{
- var writer = Marshaller.StartMarshal(stream);
-
- writer.Write(initialValue);
-
- Marshaller.FinishMarshal(writer);
+ w.WriteString(name);
+ w.WriteObject(initialValue);
+ w.WriteBoolean(create);
+ });
- var memPtr = stream.SynchronizeOutput();
-
- return UU.ProcessorAtomicReference(_proc, name, memPtr, true);
- }
+ return refTarget == null ? null : new AtomicReference<T>(refTarget, Marshaller, name);
}
/** <inheritdoc /> */
public IgniteConfiguration GetConfiguration()
{
- using (var stream = IgniteManager.Memory.Allocate(1024).GetStream())
- {
- UU.ProcessorGetIgniteConfiguration(_proc, stream.MemoryPointer);
-
- stream.SynchronizeInput();
-
- return new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(stream), _cfg);
- }
+ return DoInOp((int) Op.GetIgniteConfiguration,
+ s => new IgniteConfiguration(BinaryUtils.Marshaller.StartUnmarshal(s), _cfg));
}
/** <inheritdoc /> */
public ICache<TK, TV> CreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration)
{
- return GetOrCreateNearCache0<TK, TV>(name, configuration, UU.ProcessorCreateNearCache);
+ return GetOrCreateNearCache0<TK, TV>(name, configuration, Op.CreateNearCache);
}
/** <inheritdoc /> */
public ICache<TK, TV> GetOrCreateNearCache<TK, TV>(string name, NearCacheConfiguration configuration)
{
- return GetOrCreateNearCache0<TK, TV>(name, configuration, UU.ProcessorGetOrCreateNearCache);
+ return GetOrCreateNearCache0<TK, TV>(name, configuration, Op.GetOrCreateNearCache);
}
/** <inheritdoc /> */
public ICollection<string> GetCacheNames()
{
- using (var stream = IgniteManager.Memory.Allocate(1024).GetStream())
+ return OutStream((int) Op.GetCacheNames, r =>
{
- UU.ProcessorGetCacheNames(_proc, stream.MemoryPointer);
- stream.SynchronizeInput();
-
- var reader = _marsh.StartUnmarshal(stream);
- var res = new string[stream.ReadInt()];
+ var res = new string[r.ReadInt()];
- for (int i = 0; i < res.Length; i++)
- res[i] = reader.ReadString();
+ for (var i = 0; i < res.Length; i++)
+ res[i] = r.ReadString();
- return res;
- }
+ return (ICollection<string>) res;
+ });
}
/** <inheritdoc /> */
@@ -768,20 +772,17 @@ namespace Apache.Ignite.Core.Impl
/// Gets or creates near cache.
/// </summary>
private ICache<TK, TV> GetOrCreateNearCache0<TK, TV>(string name, NearCacheConfiguration configuration,
- Func<IUnmanagedTarget, string, long, IUnmanagedTarget> func)
+ Op op)
{
IgniteArgumentCheck.NotNull(configuration, "configuration");
- using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ var cacheTarget = DoOutOpObject((int) op, w =>
{
- var writer = BinaryUtils.Marshaller.StartMarshal(stream);
+ w.WriteString(name);
+ configuration.Write(w);
+ });
- configuration.Write(writer);
-
- stream.SynchronizeOutput();
-
- return Cache<TK, TV>(func(_proc, name, stream.MemoryPointer));
- }
+ return GetCache<TK, TV>(cacheTarget);
}
/// <summary>
@@ -794,14 +795,6 @@ namespace Apache.Ignite.Core.Impl
}
/// <summary>
- /// Marshaller.
- /// </summary>
- internal Marshaller Marshaller
- {
- get { return _marsh; }
- }
-
- /// <summary>
/// Gets the binary processor.
/// </summary>
internal BinaryProcessor BinaryProcessor
@@ -892,5 +885,43 @@ namespace Apache.Ignite.Core.Impl
{
get { return _pluginProcessor; }
}
+
+ /// <summary>
+ /// Notify processor that it is safe to use.
+ /// </summary>
+ internal void ProcessorReleaseStart()
+ {
+ InLongOutLong((int) Op.ReleaseStart, 0);
+ }
+
+ /// <summary>
+ /// Checks whether log level is enabled in Java logger.
+ /// </summary>
+ internal bool LoggerIsLevelEnabled(LogLevel logLevel)
+ {
+ return InLongOutLong((int) Op.LoggerIsLevelEnabled, (long) logLevel) == True;
+ }
+
+ /// <summary>
+ /// Logs to the Java logger.
+ /// </summary>
+ internal void LoggerLog(LogLevel level, string msg, string category, string err)
+ {
+ InStreamOutLong((int) Op.LoggerLog, w =>
+ {
+ w.WriteInt((int) level);
+ w.WriteString(msg);
+ w.WriteString(category);
+ w.WriteString(err);
+ });
+ }
+
+ /// <summary>
+ /// Gets the platform plugin extension.
+ /// </summary>
+ internal IPlatformTarget GetExtension(int id)
+ {
+ return InStreamOutObject((int) Op.GetExtension, w => w.WriteInt(id));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
index 23e7a37..2e47fe8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Log/JavaLogger.cs
@@ -21,7 +21,6 @@ namespace Apache.Ignite.Core.Impl.Log
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
- using Apache.Ignite.Core.Impl.Unmanaged;
using Apache.Ignite.Core.Log;
/// <summary>
@@ -30,7 +29,7 @@ namespace Apache.Ignite.Core.Impl.Log
internal class JavaLogger : ILogger
{
/** */
- private IUnmanagedTarget _proc;
+ private Ignite _ignite;
/** */
private readonly List<LogLevel> _enabledLevels = new List<LogLevel>(5);
@@ -45,19 +44,19 @@ namespace Apache.Ignite.Core.Impl.Log
/// <summary>
/// Sets the processor.
/// </summary>
- /// <param name="proc">The proc.</param>
- public void SetProcessor(IUnmanagedTarget proc)
+ /// <param name="ignite">The proc.</param>
+ public void SetIgnite(Ignite ignite)
{
- Debug.Assert(proc != null);
+ Debug.Assert(ignite != null);
lock (_syncRoot)
{
- _proc = proc;
+ _ignite = ignite;
// Preload enabled levels.
_enabledLevels.AddRange(
- new[] { LogLevel.Trace, LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error }
- .Where(x => UnmanagedUtils.ProcessorLoggerIsLevelEnabled(proc, (int)x)));
+ new[] {LogLevel.Trace, LogLevel.Debug, LogLevel.Info, LogLevel.Warn, LogLevel.Error}
+ .Where(x => ignite.LoggerIsLevelEnabled(x)));
foreach (var log in _pendingLogs)
{
@@ -82,7 +81,7 @@ namespace Apache.Ignite.Core.Impl.Log
var msg = args == null ? message : string.Format(formatProvider, message, args);
var err = ex != null ? ex.ToString() : null;
- if (_proc != null)
+ if (_ignite != null)
Log(level, msg, category, err);
else
_pendingLogs.Add(Tuple.Create(level, msg, category, err));
@@ -94,7 +93,7 @@ namespace Apache.Ignite.Core.Impl.Log
{
lock (_syncRoot)
{
- return _proc == null || _enabledLevels.Contains(level);
+ return _ignite == null || _enabledLevels.Contains(level);
}
}
@@ -104,7 +103,9 @@ namespace Apache.Ignite.Core.Impl.Log
private void Log(LogLevel level, string msg, string category, string err)
{
if (IsEnabled(level))
- UnmanagedUtils.ProcessorLoggerLog(_proc, (int)level, msg, category, err);
+ {
+ _ignite.LoggerLog(level, msg, category, err);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
index 8dd8eaf..474af0e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -300,7 +300,7 @@ namespace Apache.Ignite.Core.Impl
/// </summary>
/// <param name="type">Operation type.</param>
/// <param name="action">Action to be performed on the stream.</param>
- /// <returns></returns>
+ /// <returns>Resulting object.</returns>
protected IUnmanagedTarget DoOutOpObject(int type, Action<BinaryWriter> action)
{
using (var stream = IgniteManager.Memory.Allocate().GetStream())
@@ -319,6 +319,22 @@ namespace Apache.Ignite.Core.Impl
/// Perform out operation.
/// </summary>
/// <param name="type">Operation type.</param>
+ /// <param name="action">Action to be performed on the stream.</param>
+ /// <returns>Resulting object.</returns>
+ protected IUnmanagedTarget DoOutOpObject(int type, Action<IBinaryStream> action)
+ {
+ using (var stream = IgniteManager.Memory.Allocate().GetStream())
+ {
+ action(stream);
+
+ return UU.TargetInStreamOutObject(_target, type, stream.SynchronizeOutput());
+ }
+ }
+
+ /// <summary>
+ /// Perform out operation.
+ /// </summary>
+ /// <param name="type">Operation type.</param>
/// <returns>Resulting object.</returns>
protected IUnmanagedTarget DoOutOpObject(int type)
{
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
index cc20cb3..eac7556 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Plugin/PluginContext.cs
@@ -20,7 +20,6 @@ namespace Apache.Ignite.Core.Impl.Plugin
using Apache.Ignite.Core.Common;
using Apache.Ignite.Core.Impl.Common;
using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Impl.Unmanaged;
using Apache.Ignite.Core.Interop;
using Apache.Ignite.Core.Plugin;
@@ -65,11 +64,7 @@ namespace Apache.Ignite.Core.Impl.Plugin
/** <inheritdoc /> */
public IPlatformTarget GetExtension(int id)
{
- var ignite = _pluginProcessor.Ignite;
-
- var ext = UnmanagedUtils.ProcessorExtension(ignite.InteropProcessor, id);
-
- return new PlatformTarget(ext, ignite.Marshaller);
+ return _pluginProcessor.Ignite.GetExtension(id);
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
index 289589f..1720a79 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IgniteJniNativeMethods.cs
@@ -30,105 +30,16 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
public static extern int Reallocate(long memPtr, int cap);
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStart")]
- public static extern void* IgnitionStart(void* ctx, sbyte* cfgPath, sbyte* gridName, int factoryId,
+ public static extern void IgnitionStart(void* ctx, sbyte* cfgPath, sbyte* gridName, int factoryId,
long dataPtr);
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStop")]
[return: MarshalAs(UnmanagedType.U1)]
public static extern bool IgnitionStop(void* ctx, sbyte* gridName, [MarshalAs(UnmanagedType.U1)] bool cancel);
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteIgnitionStopAll")]
- public static extern void IgnitionStopAll(void* ctx, [MarshalAs(UnmanagedType.U1)] bool cancel);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorReleaseStart")]
- public static extern void ProcessorReleaseStart(void* ctx, void* obj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorProjection")]
- public static extern void* ProcessorProjection(void* ctx, void* obj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCache")]
- public static extern void* ProcessorCache(void* ctx, void* obj, sbyte* name);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateCache")]
- public static extern void* ProcessorCreateCache(void* ctx, void* obj, sbyte* name);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateCacheFromConfig")]
- public static extern void* ProcessorCreateCacheFromConfig(void* ctx, void* obj, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateCache")]
- public static extern void* ProcessorGetOrCreateCache(void* ctx, void* obj, sbyte* name);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateCacheFromConfig")]
- public static extern void* ProcessorGetOrCreateCacheFromConfig(void* ctx, void* obj, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCreateNearCache")]
- public static extern void* ProcessorCreateNearCache(void* ctx, void* obj, sbyte* name, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetOrCreateNearCache")]
- public static extern void* ProcessorGetOrCreateNearCache(void* ctx, void* obj, sbyte* name, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorDestroyCache")]
- public static extern void ProcessorDestroyCache(void* ctx, void* obj, sbyte* name);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAffinity")]
- public static extern void* ProcessorAffinity(void* ctx, void* obj, sbyte* name);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorDataStreamer")]
- public static extern void* ProcessorDataStreamer(void* ctx, void* obj, sbyte* name,
- [MarshalAs(UnmanagedType.U1)] bool keepBinary);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorTransactions")]
- public static extern void* ProcessorTransactions(void* ctx, void* obj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorCompute")]
- public static extern void* ProcessorCompute(void* ctx, void* obj, void* prj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorMessage")]
- public static extern void* ProcessorMessage(void* ctx, void* obj, void* prj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorEvents")]
- public static extern void* ProcessorEvents(void* ctx, void* obj, void* prj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorServices")]
- public static extern void* ProcessorServices(void* ctx, void* obj, void* prj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtensions")]
- public static extern void* ProcessorExtensions(void* ctx, void* obj);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorExtension")]
- public static extern void* ProcessorExtension(void* ctx, void* obj, int id);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicLong")]
- public static extern void* ProcessorAtomicLong(void* ctx, void* obj, sbyte* name, long initVal,
- [MarshalAs(UnmanagedType.U1)] bool create);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicSequence")]
- public static extern void* ProcessorAtomicSequence(void* ctx, void* obj, sbyte* name, long initVal,
- [MarshalAs(UnmanagedType.U1)] bool create);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorAtomicReference")]
- public static extern void* ProcessorAtomicReference(void* ctx, void* obj, sbyte* name, long memPtr,
- [MarshalAs(UnmanagedType.U1)] bool create);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetIgniteConfiguration")]
- public static extern void ProcessorGetIgniteConfiguration(void* ctx, void* obj, long memPtr);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorGetCacheNames")]
- public static extern void ProcessorGetCacheNames(void* ctx, void* obj, long memPtr);
-
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInLongOutLong")]
public static extern long TargetInLongOutLong(void* ctx, void* target, int opType, long val);
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerIsLevelEnabled")]
- [return: MarshalAs(UnmanagedType.U1)]
- public static extern bool ProcessorLoggerIsLevelEnabled(void* ctx, void* obj, int level);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorLoggerLog")]
- public static extern void ProcessorLoggerLog(void* ctx, void* obj, int level, sbyte* messsage, sbyte* category, sbyte* errorInfo);
-
- [DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteProcessorBinaryProcessor")]
- public static extern void* ProcessorBinaryProcessor(void* ctx, void* obj);
-
[DllImport(IgniteUtils.FileIgniteJniDll, EntryPoint = "IgniteTargetInStreamOutLong")]
public static extern long TargetInStreamOutLong(void* ctx, void* target, int opType, long memPtr);
[09/19] ignite git commit: IGNITE-5697 Web Console: Upgrade
dependencies.
Posted by sb...@apache.org.
IGNITE-5697 Web Console: Upgrade dependencies.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f277530a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f277530a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f277530a
Branch: refs/heads/ignite-5578
Commit: f277530ab6a9a6f03fd66f95a7a4d91a3506dcf5
Parents: 39fa8fa
Author: Andrey Novikov <an...@gridgain.com>
Authored: Tue Jul 25 15:24:13 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Jul 25 15:24:13 2017 +0700
----------------------------------------------------------------------
modules/web-console/backend/.eslintrc | 39 ++++++------
modules/web-console/backend/package.json | 27 ++++----
modules/web-console/frontend/.eslintrc | 40 +++++-------
modules/web-console/frontend/app/app.js | 37 ++++++-----
.../components/activities-user-dialog/index.js | 28 ++++-----
.../page-configure-advanced/controller.js | 9 +--
.../components/page-configure-basic/service.js | 8 +--
.../app/components/page-configure/controller.js | 12 +---
.../page-configure/controller.spec.js | 48 --------------
.../page-configure/services/PageConfigure.js | 18 +++---
.../components/web-console-header/component.js | 12 ++--
.../app/components/web-console-header/index.js | 4 +-
.../frontend/app/modules/ace.module.js | 6 +-
.../app/modules/branding/branding.module.js | 16 +++--
.../generator/ConfigurationGenerator.js | 2 +-
.../generator/PlatformGenerator.js | 4 +-
.../frontend/app/modules/demo/Demo.module.js | 10 +--
.../app/modules/dialog/dialog.controller.js | 4 --
.../app/modules/form/field/label.directive.js | 4 +-
.../app/modules/form/field/tooltip.directive.js | 4 +-
.../frontend/app/modules/sql/sql.controller.js | 2 +-
.../frontend/app/modules/sql/sql.module.js | 66 ++++++++++----------
.../frontend/app/modules/states/admin.state.js | 6 +-
.../app/modules/states/configuration.state.js | 35 ++++++-----
.../summary/summary-zipper.service.js | 2 +-
.../frontend/app/modules/states/errors.state.js | 4 +-
.../frontend/app/modules/states/logout.state.js | 12 ++--
.../app/modules/states/password.state.js | 4 +-
.../app/modules/states/profile.state.js | 9 ++-
.../frontend/app/modules/states/signin.state.js | 32 +++++-----
.../app/modules/user/AclRoute.provider.js | 6 +-
.../frontend/app/modules/user/user.module.js | 30 ++++++++-
.../app/services/CopyToClipboard.service.js | 4 +-
.../app/services/LegacyTable.service.js | 2 +-
modules/web-console/frontend/app/vendor.js | 8 ++-
modules/web-console/frontend/package.json | 57 ++++++++---------
modules/web-console/frontend/views/index.pug | 14 +----
37 files changed, 292 insertions(+), 333 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/backend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/.eslintrc b/modules/web-console/backend/.eslintrc
index 7eb04b7..1915518 100644
--- a/modules/web-console/backend/.eslintrc
+++ b/modules/web-console/backend/.eslintrc
@@ -3,19 +3,21 @@ env:
node: true
mocha: true
-ecmaFeatures:
- arrowFunctions: true
- blockBindings: true
- classes: true
- defaultParams: true
- destructuring: true
- module: true
- objectLiteralComputedProperties: true
- objectLiteralShorthandMethods: true
- objectLiteralShorthandProperties: true
- spread: true
- templateStrings: true
- experimentalObjectRestSpread: true
+parserOptions:
+ sourceType: module
+ ecmaFeatures:
+ arrowFunctions: true
+ blockBindings: true
+ classes: true
+ defaultParams: true
+ destructuring: true
+ module: true
+ objectLiteralComputedProperties: true
+ objectLiteralShorthandMethods: true
+ objectLiteralShorthandProperties: true
+ spread: true
+ templateStrings: true
+ experimentalObjectRestSpread: true
globals:
_: true
@@ -47,7 +49,7 @@ rules:
guard-for-in: 1
handle-callback-err: 0
id-length: [2, {"min": 1, "max": 60}]
- indent: [2, 4, {"SwitchCase": 1}]
+ indent: [2, 4, {"SwitchCase": 1, "MemberExpression": "off", "CallExpression": {"arguments": "off"}}]
key-spacing: [2, { "beforeColon": false, "afterColon": true }]
lines-around-comment: 0
linebreak-style: [0, "unix"]
@@ -104,7 +106,7 @@ rules:
no-loop-func: 2
no-mixed-requires: [0, false]
no-mixed-spaces-and-tabs: [2, true]
- no-multi-spaces: 2
+ no-multi-spaces: ["error", {"exceptions": { "VariableDeclarator": true }}]
no-multi-str: 2
no-multiple-empty-lines: [0, {"max": 2}]
no-native-reassign: 2
@@ -130,7 +132,7 @@ rules:
no-script-url: 0
no-self-compare: 2
no-sequences: 2
- no-shadow: 2
+ no-shadow: 0
no-shadow-restricted-names: 2
no-spaced-func: 2
no-sparse-arrays: 1
@@ -162,7 +164,7 @@ rules:
prefer-const: 1
prefer-spread: 2
quote-props: [2, "as-needed"]
- quotes: [2, "single"]
+ quotes: [2, "single", {"allowTemplateLiterals": true}]
radix: 1
semi: [2, "always"]
semi-spacing: [2, {"before": false, "after": true}]
@@ -181,6 +183,3 @@ rules:
wrap-iife: 0
wrap-regex: 0
yoda: [2, "never"]
-
-parserOptions:
- sourceType: module
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/backend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/package.json b/modules/web-console/backend/package.json
index 2af7787..837f41c 100644
--- a/modules/web-console/backend/package.json
+++ b/modules/web-console/backend/package.json
@@ -29,19 +29,19 @@
"win32"
],
"dependencies": {
- "body-parser": "1.17.1",
+ "body-parser": "1.17.2",
"connect-mongo": "1.3.2",
- "cookie-parser": "~1.4.0",
- "express": "4.15.2",
- "express-session": "1.15.2",
+ "cookie-parser": "1.4.3",
+ "express": "4.15.3",
+ "express-session": "1.15.4",
"fire-up": "1.0.0",
- "glob": "7.1.1",
+ "glob": "7.1.2",
"jszip": "3.1.3",
"lodash": "4.17.4",
- "mongoose": "4.9.4",
- "morgan": "1.8.1",
+ "mongoose": "4.11.4",
+ "morgan": "1.8.2",
"nconf": "0.8.4",
- "nodemailer": "3.1.4",
+ "nodemailer": "4.0.1",
"passport": "0.3.2",
"passport-local": "1.0.0",
"passport-local-mongoose": "4.0.0",
@@ -49,12 +49,11 @@
"socket.io": "1.7.3"
},
"devDependencies": {
- "chai": "3.5.0",
- "cross-env": "4.0.0",
- "eslint": "3.19.0",
- "eslint-friendly-formatter": "2.0.7",
- "jasmine-core": "2.5.2",
- "mocha": "3.2.0",
+ "chai": "4.1.0",
+ "cross-env": "5.0.1",
+ "eslint": "4.3.0",
+ "eslint-friendly-formatter": "3.0.0",
+ "mocha": "3.4.2",
"mocha-teamcity-reporter": "1.1.1",
"mockgoose": "6.0.8",
"supertest": "3.0.0"
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.eslintrc b/modules/web-console/frontend/.eslintrc
index d88fb97..4e24d0b 100644
--- a/modules/web-console/frontend/.eslintrc
+++ b/modules/web-console/frontend/.eslintrc
@@ -6,20 +6,21 @@ plugins:
env:
es6: true
browser: true
-
-ecmaFeatures:
- arrowFunctions: true
- blockBindings: true
- classes: true
- defaultParams: true
- destructuring: true
- module: true
- objectLiteralComputedProperties: true
- objectLiteralShorthandMethods: true
- objectLiteralShorthandProperties: true
- spread: true
- templateStrings: true
- experimentalObjectRestSpread: true
+parserOptions:
+ sourceType: module
+ ecmaFeatures:
+ arrowFunctions: true
+ blockBindings: true
+ classes: true
+ defaultParams: true
+ destructuring: true
+ module: true
+ objectLiteralComputedProperties: true
+ objectLiteralShorthandMethods: true
+ objectLiteralShorthandProperties: true
+ spread: true
+ templateStrings: true
+ experimentalObjectRestSpread: true
globals:
_: true
@@ -29,10 +30,6 @@ globals:
window: true
global: true
angular: true
- $generatorCommon: true
- $generatorSpring: true
- $generatorJava: true
- $generatorOptional: true
saveAs: true
process: true
require: true
@@ -63,7 +60,7 @@ rules:
guard-for-in: 1
handle-callback-err: 0
id-length: [2, {"min": 1, "max": 60}]
- indent: [2, 4, {"SwitchCase": 1}]
+ indent: [2, 4, {"SwitchCase": 1, "MemberExpression": "off", "CallExpression": {"arguments": "off"}}]
key-spacing: [2, { "beforeColon": false, "afterColon": true }]
lines-around-comment: 0
linebreak-style: [0, "unix"]
@@ -138,7 +135,7 @@ rules:
no-path-concat: 0
no-plusplus: 0
no-process-env: 0
- no-process-exit: 1
+ no-process-exit: 0
no-proto: 2
no-redeclare: 2
no-regex-spaces: 1
@@ -198,6 +195,3 @@ rules:
wrap-regex: 0
yoda: [2, "never"]
babel/semi: 2
-
-parserOptions:
- sourceType: module
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 0667e8f..e2d609a 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -133,8 +133,7 @@ import IgniteModules from 'IgniteModules/index';
import baseTemplate from 'views/base.pug';
-angular
-.module('ignite-console', [
+angular.module('ignite-console', [
// Optional AngularJS modules.
'ngAnimate',
'ngSanitize',
@@ -143,6 +142,7 @@ angular
'btford.socket-io',
'mgcrea.ngStrap',
'ui.router',
+ 'ui.router.state.events',
'gridster',
'dndLists',
'nvd3',
@@ -278,33 +278,32 @@ angular
$urlRouterProvider.otherwise('/404');
$locationProvider.html5Mode(true);
}])
-.run(['$rootScope', '$state', 'MetaTags', 'gettingStarted', ($root, $state, $meta, gettingStarted) => {
+.run(['$rootScope', '$state', 'gettingStarted', ($root, $state, gettingStarted) => {
$root._ = _;
$root.$state = $state;
- $root.$meta = $meta;
$root.gettingStarted = gettingStarted;
}])
.run(['$rootScope', 'AgentManager', ($root, agentMgr) => {
$root.$on('user', () => agentMgr.connect());
}])
-.run(['$rootScope', ($root) => {
- $root.$on('$stateChangeStart', () => {
+.run(['$transitions', ($transitions) => {
+ $transitions.onStart({ }, () => {
_.forEach(angular.element('.modal'), (m) => angular.element(m).scope().$hide());
});
- if (!$root.IgniteDemoMode) {
- $root.$on('$stateChangeSuccess', (event, {name, unsaved}, params) => {
- try {
- if (unsaved)
- localStorage.removeItem('lastStateChangeSuccess');
- else
- localStorage.setItem('lastStateChangeSuccess', JSON.stringify({name, params}));
- }
- catch (ignored) {
- // No-op.
- }
- });
- }
+ $transitions.onSuccess({ }, (trans) => {
+ try {
+ const {name, params, unsaved} = trans.$to();
+
+ if (unsaved)
+ localStorage.removeItem('lastStateChangeSuccess');
+ else
+ localStorage.setItem('lastStateChangeSuccess', JSON.stringify({name, params}));
+ }
+ catch (ignored) {
+ // No-op.
+ }
+ });
}])
.run(['$rootScope', '$http', '$state', 'IgniteMessages', 'User', 'IgniteNotebookData',
($root, $http, $state, Messages, User, Notebook) => { // eslint-disable-line no-shadow
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/activities-user-dialog/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/activities-user-dialog/index.js b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
index 02c7c1e..13c1d95 100644
--- a/modules/web-console/frontend/app/components/activities-user-dialog/index.js
+++ b/modules/web-console/frontend/app/components/activities-user-dialog/index.js
@@ -15,20 +15,20 @@
* limitations under the License.
*/
- import controller from './activities-user-dialog.controller';
- import templateUrl from './activities-user-dialog.tpl.pug';
+import controller from './activities-user-dialog.controller';
+import templateUrl from './activities-user-dialog.tpl.pug';
- export default ['$modal', ($modal) => ({ show = true, user }) => {
- const ActivitiesUserDialog = $modal({
- templateUrl,
- show,
- resolve: {
- user: () => user
- },
- controller,
- controllerAs: 'ctrl'
- });
+export default ['$modal', ($modal) => ({ show = true, user }) => {
+ const ActivitiesUserDialog = $modal({
+ templateUrl,
+ show,
+ resolve: {
+ user: () => user
+ },
+ controller,
+ controllerAs: 'ctrl'
+ });
- return ActivitiesUserDialog.$promise
+ return ActivitiesUserDialog.$promise
.then(() => ActivitiesUserDialog);
- }];
+}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/page-configure-advanced/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-advanced/controller.js b/modules/web-console/frontend/app/components/page-configure-advanced/controller.js
index 0e73ae3..da20527 100644
--- a/modules/web-console/frontend/app/components/page-configure-advanced/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-advanced/controller.js
@@ -16,7 +16,7 @@
*/
export default class PageConfigureAdvancedController {
- static $inject = ['PageConfigureAdvanced', '$scope'];
+ static $inject = ['$scope'];
static menuItems = [
{ text: 'Clusters', sref: 'base.configuration.tabs.advanced.clusters' },
@@ -26,14 +26,11 @@ export default class PageConfigureAdvancedController {
{ text: 'Summary', sref: 'base.configuration.tabs.advanced.summary' }
];
- constructor(PageConfigureAdvanced, $scope) {
- Object.assign(this, {PageConfigureAdvanced, $scope});
+ constructor($scope) {
+ Object.assign(this, {$scope});
}
$onInit() {
this.menuItems = this.constructor.menuItems;
- this.$scope.$on('$stateChangeSuccess', (e, toState) => {
- this.PageConfigureAdvanced.onStateEnterRedirect(toState);
- });
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/page-configure-basic/service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/service.js b/modules/web-console/frontend/app/components/page-configure-basic/service.js
index 4db61ea..0032106 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/service.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/service.js
@@ -50,7 +50,7 @@ export default class PageConfigureBasic {
const noFakeIDCaches = caches.map(stripFakeID);
cluster = cloneDeep(stripFakeID(cluster));
return this.$q.all(noFakeIDCaches.map((cache) => (
- this.caches.saveCache(cache)
+ this.caches.saveCache(cache)
.then(
({data}) => data,
(e) => {
@@ -58,7 +58,7 @@ export default class PageConfigureBasic {
return this.$q.resolve(null);
}
)
- )))
+ )))
.then((cacheIDs) => {
// Make sure we don't loose new IDs even if some requests fail
this.pageConfigure.upsertCaches(
@@ -115,8 +115,8 @@ export default class PageConfigureBasic {
setCluster(_id) {
this.ConfigureState.dispatchAction(
isNewItem({_id})
- ? {type: SET_CLUSTER, _id, cluster: this.clusters.getBlankCluster()}
- : {type: SET_CLUSTER, _id}
+ ? {type: SET_CLUSTER, _id, cluster: this.clusters.getBlankCluster()}
+ : {type: SET_CLUSTER, _id}
);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/page-configure/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/controller.js b/modules/web-console/frontend/app/components/page-configure/controller.js
index 3dcd14e..5ead0bb 100644
--- a/modules/web-console/frontend/app/components/page-configure/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure/controller.js
@@ -16,15 +16,9 @@
*/
export default class PageConfigureController {
- static $inject = ['$scope', 'PageConfigure'];
+ static $inject = ['$scope'];
- constructor($scope, PageConfigure) {
- Object.assign(this, {$scope, PageConfigure});
- }
-
- $onInit() {
- this.$scope.$on('$stateChangeSuccess', (e, toState) => {
- this.PageConfigure.onStateEnterRedirect(toState);
- });
+ constructor($scope) {
+ Object.assign(this, {$scope});
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/page-configure/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/controller.spec.js b/modules/web-console/frontend/app/components/page-configure/controller.spec.js
deleted file mode 100644
index e30eb65..0000000
--- a/modules/web-console/frontend/app/components/page-configure/controller.spec.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-import {suite, test} from 'mocha';
-import {assert} from 'chai';
-import {spy} from 'sinon';
-
-import Controller from './controller';
-
-const mocks = () => new Map([
- ['$scope', {
- $on: spy()
- }],
- ['PageConfigure', {
- onStateEnterRedirect: spy()
- }]
-]);
-
-suite('page-configure component controller', () => {
- test('State change success redirect', () => {
- const c = new Controller(...mocks().values());
- c.$onInit();
- c.$scope.$on.getCall(0).args[1](null, {name: 'base.items'});
- assert.isOk(
- c.PageConfigure.onStateEnterRedirect.calledOnce,
- 'calls PageConfigure.onStateEnterRedirect every $stateChangeSuccess'
- );
- assert.deepEqual(
- c.PageConfigure.onStateEnterRedirect.getCall(0).args,
- [{name: 'base.items'}],
- 'calls PageConfigure.onStateEnterRedirect with correct arguments'
- );
- });
-});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
index a712aca..34a292a 100644
--- a/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
+++ b/modules/web-console/frontend/app/components/page-configure/services/PageConfigure.js
@@ -31,15 +31,17 @@ export default class PageConfigure {
}
onStateEnterRedirect(toState) {
- if (toState.name !== 'base.configuration.tabs') return this.$q.resolve();
+ if (toState.name !== 'base.configuration.tabs')
+ return this.$q.resolve();
+
return this.configuration.read()
- .then((data) => {
- this.loadList(data);
- const nextState = data.clusters.length
- ? 'base.configuration.tabs.advanced'
- : 'base.configuration.tabs.basic';
- return this.$state.go(nextState, null, {location: 'replace'});
- });
+ .then((data) => {
+ this.loadList(data);
+
+ return this.$q.resolve(data.clusters.length
+ ? 'base.configuration.tabs.advanced'
+ : 'base.configuration.tabs.basic');
+ });
}
loadList(list) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/web-console-header/component.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-header/component.js b/modules/web-console/frontend/app/components/web-console-header/component.js
index d4c5c4b..66f09e9 100644
--- a/modules/web-console/frontend/app/components/web-console-header/component.js
+++ b/modules/web-console/frontend/app/components/web-console-header/component.js
@@ -33,11 +33,15 @@ export default {
Object.assign(this, {$rootScope, $scope, $state, branding, UserNotifications});
}
+ setWebAgentDownloadVisible() {
+ this.isWebAgentDownloadVisible =
+ this.constructor.webAgentDownloadVisibleStates.some((state) => this.$state.includes(state));
+ }
+
$onInit() {
- this.$scope.$on('$stateChangeSuccess', () => {
- this.isWebAgentDownloadVisible =
- this.constructor.webAgentDownloadVisibleStates.some((state) => this.$state.includes(state));
- });
+ this.setWebAgentDownloadVisible();
+
+ this.$scope.$on('$stateChangeSuccess', () => this.setWebAgentDownloadVisible());
}
},
transclude: {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/components/web-console-header/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/web-console-header/index.js b/modules/web-console/frontend/app/components/web-console-header/index.js
index 36caa3d..e41e1cc 100644
--- a/modules/web-console/frontend/app/components/web-console-header/index.js
+++ b/modules/web-console/frontend/app/components/web-console-header/index.js
@@ -19,5 +19,5 @@ import angular from 'angular';
import component from './component';
export default angular
- .module('ignite-console.web-console-header', [])
- .component('webConsoleHeader', component);
+ .module('ignite-console.web-console-header', [])
+ .component('webConsoleHeader', component);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/ace.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/ace.module.js b/modules/web-console/frontend/app/modules/ace.module.js
index 4920a6f..a28536a 100644
--- a/modules/web-console/frontend/app/modules/ace.module.js
+++ b/modules/web-console/frontend/app/modules/ace.module.js
@@ -184,10 +184,10 @@ angular
return (e) => {
const newValue = session.getValue();
+ // HACK make sure to only trigger the apply outside of the
+ // digest loop 'cause ACE is actually using this callback
+ // for any text transformation !
if (ngModel && newValue !== ngModel.$viewValue &&
- // HACK make sure to only trigger the apply outside of the
- // digest loop 'cause ACE is actually using this callback
- // for any text transformation !
!scope.$$phase && !scope.$root.$$phase)
scope.$eval(() => ngModel.$setViewValue(newValue));
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/branding/branding.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/branding/branding.module.js b/modules/web-console/frontend/app/modules/branding/branding.module.js
index cae7c91..9c4a5e5 100644
--- a/modules/web-console/frontend/app/modules/branding/branding.module.js
+++ b/modules/web-console/frontend/app/modules/branding/branding.module.js
@@ -28,14 +28,18 @@ import ignitePoweredByApache from './powered-by-apache.directive';
angular
.module('ignite-console.branding', [
- 'ui.router.metatags'
+ 'tf.metatags'
])
.provider(...IgniteBranding)
-.config(['UIRouterMetatagsProvider', (UIRouterMetatagsProvider) => {
- UIRouterMetatagsProvider
- .setDefaultTitle('Apache Ignite - Management Tool and Configuration Wizard')
- .setTitleSuffix(' – Apache Ignite Web Console')
- .setDefaultDescription('The Apache Ignite Web Console is an interactive management tool and configuration wizard which walks you through the creation of config files. Try it now.');
+.config(['tfMetaTagsProvider', (tfMetaTagsProvider) => {
+ tfMetaTagsProvider.setDefaults({
+ title: 'Apache Ignite - Management Tool and Configuration Wizard',
+ properties: {
+ description: 'The Apache Ignite Web Console is an interactive management tool and configuration wizard which walks you through the creation of config files. Try it now.'
+ }
+ });
+
+ tfMetaTagsProvider.setTitleSuffix(' – Apache Ignite Web Console');
}])
.directive(...ignitePoweredByApache)
.directive(...igniteHeaderLogo)
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
index 8299b9b..a14bfd3 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/ConfigurationGenerator.js
@@ -887,7 +887,7 @@ export default class IgniteConfigurationGenerator {
cfg.intProperty('peerClassLoadingMissedResourcesCacheSize')
.intProperty('peerClassLoadingThreadPoolSize')
.varArgProperty('p2pLocClsPathExcl', 'peerClassLoadingLocalClassPathExclude',
- cluster.peerClassLoadingLocalClassPathExclude);
+ cluster.peerClassLoadingLocalClassPathExclude);
}
// Since ignite 2.0
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
index b076193..234c7ec 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/PlatformGenerator.js
@@ -168,7 +168,7 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
.intProperty('unacknowledgedMessagesBufferSize')
// .intProperty('socketWriteTimeout')
.intProperty('selectorsCount');
- // .emptyBeanProperty('addressResolver');
+ // .emptyBeanProperty('addressResolver');
if (commSpi.nonEmpty())
cfg.beanProperty('CommunicationSpi', commSpi);
@@ -176,7 +176,7 @@ export default ['JavaTypes', 'igniteClusterPlatformDefaults', 'igniteCachePlatfo
cfg.intProperty('networkTimeout', 'NetworkTimeout')
.intProperty('networkSendRetryDelay')
.intProperty('networkSendRetryCount');
- // .intProperty('discoveryStartupDelay');
+ // .intProperty('discoveryStartupDelay');
return cfg;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/demo/Demo.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/demo/Demo.module.js b/modules/web-console/frontend/app/modules/demo/Demo.module.js
index d75beda..2445461 100644
--- a/modules/web-console/frontend/app/modules/demo/Demo.module.js
+++ b/modules/web-console/frontend/app/modules/demo/Demo.module.js
@@ -24,7 +24,7 @@ angular
.module('ignite-console.demo', [
'ignite-console.socket'
])
-.config(['$stateProvider', 'AclRouteProvider', ($stateProvider, AclRoute) => {
+.config(['$stateProvider', ($stateProvider) => {
$stateProvider
.state('demo', {
abstract: true,
@@ -33,17 +33,17 @@ angular
})
.state('demo.resume', {
url: '/resume',
- onEnter: AclRoute.checkAccess('demo'),
+ permission: 'demo',
controller: ['$state', ($state) => {
$state.go('base.configuration.tabs.advanced.clusters');
}],
- metaTags: {
+ tfMetaTags: {
title: 'Demo resume'
}
})
.state('demo.reset', {
url: '/reset',
- onEnter: AclRoute.checkAccess('demo'),
+ permission: 'demo',
controller: ['$state', '$http', 'IgniteMessages', ($state, $http, Messages) => {
$http.post('/api/v1/demo/reset')
.then(() => $state.go('base.configuration.tabs.advanced.clusters'))
@@ -53,7 +53,7 @@ angular
Messages.showError(res);
});
}],
- metaTags: {
+ tfMetaTags: {
title: 'Demo reset'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/dialog/dialog.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/dialog/dialog.controller.js b/modules/web-console/frontend/app/modules/dialog/dialog.controller.js
index 05518d3..0256b84 100644
--- a/modules/web-console/frontend/app/modules/dialog/dialog.controller.js
+++ b/modules/web-console/frontend/app/modules/dialog/dialog.controller.js
@@ -33,8 +33,4 @@ export default ['$rootScope', '$scope', 'IgniteDialog', function($root, $scope,
$scope.$watch(() => ctrl.content, () => {
$scope.content = ctrl.content;
});
-
- $root.$on('$stateChangeStart', () => {
- dialog.hide();
- });
}];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/form/field/label.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/form/field/label.directive.js b/modules/web-console/frontend/app/modules/form/field/label.directive.js
index 97ba598..94f7889 100644
--- a/modules/web-console/frontend/app/modules/form/field/label.directive.js
+++ b/modules/web-console/frontend/app/modules/form/field/label.directive.js
@@ -20,7 +20,7 @@ export default ['igniteFormFieldLabel', [() => {
restrict: 'E',
compile() {
return {
- post($scope, $element, $attrs, [form, field], $transclude) {
+ post($scope, $element, $attrs, [field], $transclude) {
$transclude($scope, function(clone) {
const text = clone.text();
@@ -42,6 +42,6 @@ export default ['igniteFormFieldLabel', [() => {
},
replace: true,
transclude: true,
- require: ['^form', '?^igniteFormField']
+ require: ['?^igniteFormField']
};
}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/form/field/tooltip.directive.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/form/field/tooltip.directive.js b/modules/web-console/frontend/app/modules/form/field/tooltip.directive.js
index 4f440a1..9e764bc 100644
--- a/modules/web-console/frontend/app/modules/form/field/tooltip.directive.js
+++ b/modules/web-console/frontend/app/modules/form/field/tooltip.directive.js
@@ -18,7 +18,7 @@
const template = '<i class="tipField icon-help"></i>';
export default ['igniteFormFieldTooltip', ['$tooltip', ($tooltip) => {
- const link = ($scope, $element, $attrs, [form, field], $transclude) => {
+ const link = ($scope, $element, $attrs, [field], $transclude) => {
const content = Array.prototype.slice
.apply($transclude($scope))
.reduce((html, el) => html += el.outerHTML || el.textContent || el, '');
@@ -44,6 +44,6 @@ export default ['igniteFormFieldTooltip', ['$tooltip', ($tooltip) => {
link,
replace: true,
transclude: true,
- require: ['^form', '?^igniteFormField']
+ require: ['?^igniteFormField']
};
}]];
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index 633f167..3d38634 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -1247,7 +1247,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
const chartHistory = paragraph.chartHistory;
- // Clear history on query change.
+ // Clear history on query change.
if (clearChart) {
chartHistory.length = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/sql/sql.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.module.js b/modules/web-console/frontend/app/modules/sql/sql.module.js
index 79614c2..da9955c 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.module.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.module.js
@@ -27,37 +27,35 @@ import sqlTplUrl from 'app/../views/sql/sql.tpl.pug';
angular.module('ignite-console.sql', [
'ui.router'
])
- .config(['$stateProvider', 'AclRouteProvider',
- ($stateProvider, AclRoute) => {
- // set up the states
- $stateProvider
- .state('base.sql', {
- url: '/queries',
- abstract: true,
- template: '<ui-view></ui-view>'
- })
- .state('base.sql.notebook', {
- url: '/notebook/{noteId}',
- templateUrl: sqlTplUrl,
- onEnter: AclRoute.checkAccess('query'),
- metaTags: {
- title: 'Query notebook'
- },
- controller,
- controllerAs: '$ctrl'
- })
- .state('base.sql.demo', {
- url: '/demo',
- templateUrl: sqlTplUrl,
- onEnter: AclRoute.checkAccess('query'),
- metaTags: {
- title: 'SQL demo'
- },
- controller,
- controllerAs: '$ctrl'
- });
- }]
- )
- .service('IgniteNotebookData', NotebookData)
- .service('IgniteNotebook', Notebook)
- .controller('notebookController', notebook);
+.config(['$stateProvider', ($stateProvider) => {
+ // set up the states
+ $stateProvider
+ .state('base.sql', {
+ url: '/queries',
+ abstract: true,
+ template: '<ui-view></ui-view>'
+ })
+ .state('base.sql.notebook', {
+ url: '/notebook/{noteId}',
+ templateUrl: sqlTplUrl,
+ permission: 'query',
+ tfMetaTags: {
+ title: 'Query notebook'
+ },
+ controller,
+ controllerAs: '$ctrl'
+ })
+ .state('base.sql.demo', {
+ url: '/demo',
+ templateUrl: sqlTplUrl,
+ permission: 'query',
+ tfMetaTags: {
+ title: 'SQL demo'
+ },
+ controller,
+ controllerAs: '$ctrl'
+ });
+}])
+.service('IgniteNotebookData', NotebookData)
+.service('IgniteNotebook', Notebook)
+.controller('notebookController', notebook);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/admin.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/admin.state.js b/modules/web-console/frontend/app/modules/states/admin.state.js
index 7189508..65e13aa 100644
--- a/modules/web-console/frontend/app/modules/states/admin.state.js
+++ b/modules/web-console/frontend/app/modules/states/admin.state.js
@@ -24,7 +24,7 @@ angular
.module('ignite-console.states.admin', [
'ui.router'
])
-.config(['$stateProvider', 'AclRouteProvider', function($stateProvider, AclRoute) {
+.config(['$stateProvider', function($stateProvider) {
// set up the states
$stateProvider
.state('base.settings.admin', {
@@ -50,8 +50,8 @@ angular
}
},
// templateUrl,
- onEnter: AclRoute.checkAccess('admin_page'),
- metaTags: {
+ permission: 'admin_page',
+ tfMetaTags: {
title: 'Admin panel'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/configuration.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration.state.js b/modules/web-console/frontend/app/modules/states/configuration.state.js
index faf9315..d2c1410 100644
--- a/modules/web-console/frontend/app/modules/states/configuration.state.js
+++ b/modules/web-console/frontend/app/modules/states/configuration.state.js
@@ -51,7 +51,7 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
$templateCache.put('summary-tabs.html', summaryTabsTemplateUrl);
}])
// Configure state provider.
- .config(['$stateProvider', 'AclRouteProvider', ($stateProvider, AclRoute) => {
+ .config(['$stateProvider', ($stateProvider) => {
// Setup the states.
$stateProvider
.state('base.configuration', {
@@ -64,15 +64,21 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
})
.state('base.configuration.tabs', {
url: '/configuration',
+ permission: 'configuration',
template: '<page-configure></page-configure>',
- metaTags: {
+ redirectTo: (trans) => {
+ const PageConfigure = trans.injector().get('PageConfigure');
+
+ return PageConfigure.onStateEnterRedirect(trans.to());
+ },
+ tfMetaTags: {
title: 'Configuration'
}
})
.state('base.configuration.tabs.basic', {
url: '/basic',
template: '<page-configure-basic></page-configure-basic>',
- metaTags: {
+ tfMetaTags: {
title: 'Basic Configuration'
},
resolve: {
@@ -88,13 +94,14 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
})
.state('base.configuration.tabs.advanced', {
url: '/advanced',
- template: '<page-configure-advanced></page-configure-advanced>'
+ template: '<page-configure-advanced></page-configure-advanced>',
+ redirectTo: 'base.configuration.tabs.advanced.clusters'
})
.state('base.configuration.tabs.advanced.clusters', {
url: '/clusters',
templateUrl: clustersTpl,
- onEnter: AclRoute.checkAccess('configuration'),
- metaTags: {
+ permission: 'configuration',
+ tfMetaTags: {
title: 'Configure Clusters'
},
controller: clustersCtrl,
@@ -103,8 +110,8 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
.state('base.configuration.tabs.advanced.caches', {
url: '/caches',
templateUrl: cachesTpl,
- onEnter: AclRoute.checkAccess('configuration'),
- metaTags: {
+ permission: 'configuration',
+ tfMetaTags: {
title: 'Configure Caches'
},
controller: cachesCtrl,
@@ -113,8 +120,8 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
.state('base.configuration.tabs.advanced.domains', {
url: '/domains',
templateUrl: domainsTpl,
- onEnter: AclRoute.checkAccess('configuration'),
- metaTags: {
+ permission: 'configuration',
+ tfMetaTags: {
title: 'Configure Domain Model'
},
controller: domainsCtrl,
@@ -123,8 +130,8 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
.state('base.configuration.tabs.advanced.igfs', {
url: '/igfs',
templateUrl: igfsTpl,
- onEnter: AclRoute.checkAccess('configuration'),
- metaTags: {
+ permission: 'configuration',
+ tfMetaTags: {
title: 'Configure IGFS'
},
controller: igfsCtrl,
@@ -133,10 +140,10 @@ angular.module('ignite-console.states.configuration', ['ui.router'])
.state('base.configuration.tabs.advanced.summary', {
url: '/summary',
templateUrl: summaryTpl,
- onEnter: AclRoute.checkAccess('configuration'),
+ permission: 'configuration',
controller: ConfigurationSummaryCtrl,
controllerAs: 'ctrl',
- metaTags: {
+ tfMetaTags: {
title: 'Configurations Summary'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js b/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
index 0259d39..47ce9ad 100644
--- a/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
+++ b/modules/web-console/frontend/app/modules/states/configuration/summary/summary-zipper.service.js
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import Worker from 'worker?inline=true!./summary.worker';
+import Worker from 'worker!./summary.worker';
export default ['$q', function($q) {
return function(message) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/errors.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/errors.state.js b/modules/web-console/frontend/app/modules/states/errors.state.js
index e3d4d41..3cc03be 100644
--- a/modules/web-console/frontend/app/modules/states/errors.state.js
+++ b/modules/web-console/frontend/app/modules/states/errors.state.js
@@ -29,7 +29,7 @@ angular
.state('404', {
url: '/404',
templateUrl: templateNotFoundPage,
- metaTags: {
+ tfMetaTags: {
title: 'Page not found'
},
unsaved: true
@@ -37,7 +37,7 @@ angular
.state('403', {
url: '/403',
templateUrl: templateNotAuthorizedPage,
- metaTags: {
+ tfMetaTags: {
title: 'Not authorized'
},
unsaved: true
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/logout.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/logout.state.js b/modules/web-console/frontend/app/modules/states/logout.state.js
index 42795ea..9f9c7c6 100644
--- a/modules/web-console/frontend/app/modules/states/logout.state.js
+++ b/modules/web-console/frontend/app/modules/states/logout.state.js
@@ -17,18 +17,16 @@
import angular from 'angular';
-angular
-.module('ignite-console.states.logout', [
+angular.module('ignite-console.states.logout', [
'ui.router'
])
-.config(['$stateProvider', 'AclRouteProvider', function($stateProvider, AclRoute) {
+.config(['$stateProvider', function($stateProvider) {
// set up the states
- $stateProvider
- .state('logout', {
+ $stateProvider.state('logout', {
url: '/logout',
- onEnter: AclRoute.checkAccess('logout'),
+ permission: 'logout',
controller: ['Auth', (Auth) => Auth.logout()],
- metaTags: {
+ tfMetaTags: {
title: 'Logout'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/password.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/password.state.js b/modules/web-console/frontend/app/modules/states/password.state.js
index 587f83d..8e326bf 100644
--- a/modules/web-console/frontend/app/modules/states/password.state.js
+++ b/modules/web-console/frontend/app/modules/states/password.state.js
@@ -34,14 +34,14 @@ angular
.state('password.reset', {
url: '/reset?{token}',
templateUrl,
- metaTags: {
+ tfMetaTags: {
title: 'Reset password'
}
})
.state('password.send', {
url: '/send',
templateUrl,
- metaTags: {
+ tfMetaTags: {
title: 'Password Send'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/profile.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/profile.state.js b/modules/web-console/frontend/app/modules/states/profile.state.js
index 3298bdc..87d1d02 100644
--- a/modules/web-console/frontend/app/modules/states/profile.state.js
+++ b/modules/web-console/frontend/app/modules/states/profile.state.js
@@ -23,14 +23,13 @@ angular
.module('ignite-console.states.profile', [
'ui.router'
])
-.config(['$stateProvider', 'AclRouteProvider', function($stateProvider, AclRoute) {
+.config(['$stateProvider', 'AclRouteProvider', function($stateProvider) {
// set up the states
- $stateProvider
- .state('base.settings.profile', {
+ $stateProvider.state('base.settings.profile', {
url: '/profile',
templateUrl,
- onEnter: AclRoute.checkAccess('profile'),
- metaTags: {
+ permission: 'profile',
+ tfMetaTags: {
title: 'User profile'
}
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/states/signin.state.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/states/signin.state.js b/modules/web-console/frontend/app/modules/states/signin.state.js
index b7be51d..f5a4964 100644
--- a/modules/web-console/frontend/app/modules/states/signin.state.js
+++ b/modules/web-console/frontend/app/modules/states/signin.state.js
@@ -24,30 +24,26 @@ angular
// services
'ignite-console.user'
])
-.config(['$stateProvider', 'AclRouteProvider', function($stateProvider) {
+.config(['$stateProvider', function($stateProvider) {
// set up the states
$stateProvider
.state('signin', {
url: '/',
templateUrl,
- resolve: {
- user: ['$state', 'User', ($state, User) => {
- return User.read()
- .then(() => {
- try {
- const {name, params} = JSON.parse(localStorage.getItem('lastStateChangeSuccess'));
+ redirectTo: (trans) => {
+ return trans.injector().get('User').read()
+ .then(() => {
+ try {
+ const {name, params} = JSON.parse(localStorage.getItem('lastStateChangeSuccess'));
- $state.go(name, params);
- } catch (ignored) {
- $state.go('base.configuration.tabs');
- }
- })
- .catch(() => {});
- }]
- },
- controllerAs: '$ctrl',
- controller() {},
- metaTags: {
+ const restored = trans.router.stateService.target(name, params);
+
+ return restored.valid() ? restored : 'base.configuration.tabs';
+ } catch (ignored) {
+ return 'base.configuration.tabs';
+ }
+ })
+ .catch(() => true);
}
});
}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/AclRoute.provider.js b/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
index 4225bc4..f5556ff 100644
--- a/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
+++ b/modules/web-console/frontend/app/modules/user/AclRoute.provider.js
@@ -17,11 +17,9 @@
export default [() => {
class AclRoute {
- static checkAccess(permissions, failState) {
- failState = failState || '403';
-
+ static checkAccess(permissions, failState = '403') {
return ['$q', '$state', 'AclService', 'User', 'IgniteActivitiesData', function($q, $state, AclService, User, Activities) {
- const action = this.name ? $state.href(this.name) : null;
+ const action = '';
return User.read()
.catch(() => {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/modules/user/user.module.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/user/user.module.js b/modules/web-console/frontend/app/modules/user/user.module.js
index b86a62e..721d07f 100644
--- a/modules/web-console/frontend/app/modules/user/user.module.js
+++ b/modules/web-console/frontend/app/modules/user/user.module.js
@@ -50,7 +50,7 @@ angular.module('ignite-console.user', [
.service(...Auth)
.service(...User)
.provider('AclRoute', AclRouteProvider)
-.run(['$rootScope', 'AclService', ($root, AclService) => {
+.run(['$rootScope', '$transitions', 'AclService', 'User', 'IgniteActivitiesData', ($root, $transitions, AclService, User, Activities) => {
AclService.setAbilities(aclData);
AclService.attachRole('guest');
@@ -70,4 +70,32 @@ angular.module('ignite-console.user', [
AclService.attachRole(role);
});
+
+ $transitions.onBefore({}, (t) => {
+ const $state = t.router.stateService;
+ const {name, permission} = t.to();
+
+ return User.read()
+ .catch(() => {
+ User.clean();
+
+ if (name !== 'signin')
+ return $state.target('signin');
+
+ return true;
+ })
+ .then(() => {
+ if (_.isEmpty(permission))
+ return true;
+
+ if (AclService.can(permission)) {
+ Activities.post({action: $state.href(name, t.params('to'))});
+
+ return true;
+ }
+
+ return $state.target(t.to().failState || '403');
+ });
+
+ });
}]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/services/CopyToClipboard.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/CopyToClipboard.service.js b/modules/web-console/frontend/app/services/CopyToClipboard.service.js
index 74c4764..df0bb8a 100644
--- a/modules/web-console/frontend/app/services/CopyToClipboard.service.js
+++ b/modules/web-console/frontend/app/services/CopyToClipboard.service.js
@@ -38,10 +38,10 @@ export default ['IgniteCopyToClipboard', ['$window', 'IgniteMessages', ($window,
if (document.execCommand('copy'))
Messages.showInfo('Value copied to clipboard');
else
- window.prompt('Copy to clipboard: Ctrl+C, Enter', toCopy); // eslint-disable-line no-alert
+ window.prompt('Copy to clipboard: Ctrl+C, Enter', toCopy); // eslint-disable-line no-alert
}
catch (err) {
- window.prompt('Copy to clipboard: Ctrl+C, Enter', toCopy); // eslint-disable-line no-alert
+ window.prompt('Copy to clipboard: Ctrl+C, Enter', toCopy); // eslint-disable-line no-alert
}
textArea.remove();
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/services/LegacyTable.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/LegacyTable.service.js b/modules/web-console/frontend/app/services/LegacyTable.service.js
index a024a3b..ab95164 100644
--- a/modules/web-console/frontend/app/services/LegacyTable.service.js
+++ b/modules/web-console/frontend/app/services/LegacyTable.service.js
@@ -25,7 +25,7 @@ export default ['IgniteLegacyTable',
return item;
path = path.replace(/\[(\w+)\]/g, '.$1'); // convert indexes to properties
- path = path.replace(/^\./, ''); // strip a leading dot
+ path = path.replace(/^\./, ''); // strip a leading dot
const segs = path.split('.');
let root = item;
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/app/vendor.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/vendor.js b/modules/web-console/frontend/app/vendor.js
index 3bbb322..ea0f63c 100644
--- a/modules/web-console/frontend/app/vendor.js
+++ b/modules/web-console/frontend/app/vendor.js
@@ -24,9 +24,12 @@ import 'angular-strap';
import 'angular-strap/dist/angular-strap.tpl';
import 'angular-socket-io';
import 'angular-retina';
-import 'angular-ui-router';
+
+import '@uirouter/angularjs';
+import '@uirouter/angularjs/lib/legacy/stateEvents';
+
+import 'tf-metatags';
import 'angular-translate';
-import 'ui-router-metatags/dist/ui-router-metatags';
import 'angular-smart-table';
import 'angular-ui-grid/ui-grid';
import 'angular-drag-and-drop-lists';
@@ -49,6 +52,7 @@ import 'file-saver';
import 'jszip';
import 'nvd3';
import 'lodash';
+
import 'angular-gridster/dist/angular-gridster.min.css';
import 'angular-tree-control/css/tree-control-attribute.css';
import 'angular-tree-control/css/tree-control.css';
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 05c6eec..6b049ff 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -8,7 +8,7 @@
"dev": "npm start",
"build": "webpack --config ./webpack/webpack.prod.babel.js",
"test": "karma start ./test/karma.conf.js",
- "eslint": "eslint --format node_modules/eslint-friendly-formatter gulpfile.babel.js/ app/ controllers/ ignite_modules/ -- --eff-by-issue"
+ "eslint": "eslint --format node_modules/eslint-friendly-formatter app/ controllers/ ignite_modules/ -- --eff-by-issue"
},
"author": "",
"contributors": [
@@ -45,13 +45,13 @@
"angular-socket-io": "0.7.0",
"angular-strap": "2.3.12",
"angular-touch": "1.5.11",
- "angular-translate": "2.15.1",
+ "angular-translate": "2.15.2",
"angular-tree-control": "0.2.28",
- "angular-ui-grid": "4.0.4",
- "angular-ui-router": "0.4.2",
- "babel-core": "6.24.1",
+ "angular-ui-grid": "4.0.6",
+ "@uirouter/angularjs": "1.0.5",
+ "babel-core": "6.25.0",
"babel-eslint": "7.2.3",
- "babel-loader": "7.0.0",
+ "babel-loader": "7.1.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-transform-runtime": "6.23.0",
"babel-polyfill": "6.23.0",
@@ -61,45 +61,46 @@
"bootstrap-sass": "3.3.7",
"brace": "0.10.0",
"copy-webpack-plugin": "4.0.1",
- "css-loader": "0.28.3",
- "eslint": "3.19.0",
+ "css-loader": "0.28.4",
+ "eslint": "4.3.0",
"eslint-friendly-formatter": "3.0.0",
- "eslint-loader": "1.7.1",
- "eslint-plugin-babel": "^4.1.1",
+ "eslint-loader": "1.9.0",
+ "eslint-plugin-babel": "4.1.1",
"expose-loader": "0.7.3",
- "extract-text-webpack-plugin": "2.1.0",
- "file-loader": "0.11.1",
+ "extract-text-webpack-plugin": "3.0.0",
+ "file-loader": "0.11.2",
"file-saver": "1.3.3",
"font-awesome": "4.7.0",
"glob": "7.1.2",
"html-loader": "0.4.5",
- "html-webpack-plugin": "2.28.0",
+ "html-webpack-plugin": "2.29.0",
"jquery": "3.2.1",
- "json-loader": "0.5.4",
+ "json-loader": "0.5.7",
"jszip": "3.1.3",
"lodash": "4.17.4",
"node-sass": "4.5.3",
"nvd3": "1.8.4",
- "progress-bar-webpack-plugin": "1.9.3",
+ "progress-bar-webpack-plugin": "1.10.0",
"pug-html-loader": "1.1.0",
"pug-loader": "2.3.0",
"raleway-webfont": "3.0.1",
- "resolve-url-loader": "2.0.2",
+ "resolve-url-loader": "2.1.0",
"roboto-font": "0.1.0",
- "rxjs": "5.4.0",
- "sass-loader": "6.0.5",
+ "rxjs": "5.4.2",
+ "sass-loader": "6.0.6",
"socket.io-client": "1.7.3",
- "style-loader": "0.18.1",
- "svg-sprite-loader": "^3.0.5",
- "ui-router-metatags": "1.0.3",
- "webpack": "2.6.1",
- "webpack-dev-server": "2.4.5",
+ "style-loader": "0.18.2",
+ "svg-sprite-loader": "3.0.7",
+ "tf-metatags": "2.0.0",
+ "webpack": "3.3.0",
+ "webpack-dev-server": "2.6.1",
"webpack-merge": "4.1.0",
- "worker-loader": "0.8.0"
+ "worker-loader": "0.8.1"
},
"devDependencies": {
- "chai": "4.0.2",
- "jasmine-core": "2.6.2",
+ "chai": "4.1.0",
+ "type-detect": "4.0.3",
+ "jasmine-core": "2.6.4",
"karma": "1.7.0",
"karma-babel-preprocessor": "6.0.1",
"karma-jasmine": "1.1.0",
@@ -107,10 +108,10 @@
"karma-mocha-reporter": "2.2.3",
"karma-phantomjs-launcher": "1.0.4",
"karma-teamcity-reporter": "1.0.0",
- "karma-webpack": "2.0.3",
+ "karma-webpack": "2.0.4",
"mocha": "3.4.2",
"mocha-teamcity-reporter": "1.1.1",
"phantomjs-prebuilt": "2.1.14",
- "sinon": "2.3.4"
+ "sinon": "2.3.8"
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f277530a/modules/web-console/frontend/views/index.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/index.pug b/modules/web-console/frontend/views/index.pug
index f8f13dd..1881b38 100644
--- a/modules/web-console/frontend/views/index.pug
+++ b/modules/web-console/frontend/views/index.pug
@@ -23,23 +23,13 @@ html(ng-app='ignite-console' id='app' ng-strict-di)
meta(http-equiv='content-language' content='en')
meta(http-equiv='X-UA-Compatible' content='IE=Edge')
- title(ng-bind='$meta.title')
+ title(ng-bind='tfMetaTags.title')
+ meta(ng-repeat='(key, value) in tfMetaTags.properties' name='{{::key}}' content='{{::value}}')
meta(name='fragment' content='!')
- meta(name='description' content='{{$meta.description}}')
- meta(name='keywords' content='{{$meta.keywords}}')
- meta(ng-repeat='(key, value) in $meta.properties' name='{{::key}}' content='{{::value}}')
body.theme-line.body-overlap
- .splash.splash-max-foreground(hide-on-state-change)
- .splash-wrapper
- .spinner
- .bounce1
- .bounce2
- .bounce3
-
- .splash-wellcome Loading...
.ribbon-wrapper.right(ng-cloak)
.ribbon(ng-style='IgniteDemoMode && {"background": "#1b6d88"}')
[03/19] ignite git commit: IGNITE-5067 - Fixed absolute swap file
path handling for memory policy configuration. Fixes #1867
Posted by sb...@apache.org.
IGNITE-5067 - Fixed absolute swap file path handling for memory policy configuration. Fixes #1867
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6f749bf4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6f749bf4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6f749bf4
Branch: refs/heads/ignite-5578
Commit: 6f749bf4bebb135250a3f99923ed87b4b7d0c29f
Parents: c1a3b37
Author: Sergey Chugunov <se...@gmail.com>
Authored: Fri Jul 21 17:59:10 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Fri Jul 21 18:00:40 2017 +0300
----------------------------------------------------------------------
.../IgniteCacheDatabaseSharedManager.java | 22 ++-
.../database/SwapPathConstructionSelfTest.java | 157 +++++++++++++++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
3 files changed, 174 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f749bf4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index eec3b85..e07c51e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -25,7 +25,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import javax.management.JMException;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.MemoryMetrics;
@@ -204,8 +203,9 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
/**
* @param memCfg Database config.
+ * @throws IgniteCheckedException If failed to initialize swap path.
*/
- protected void initPageMemoryPolicies(MemoryConfiguration memCfg) {
+ protected void initPageMemoryPolicies(MemoryConfiguration memCfg) throws IgniteCheckedException {
MemoryPolicyConfiguration[] memPlcsCfgs = memCfg.getMemoryPolicies();
if (memPlcsCfgs == null) {
@@ -261,12 +261,13 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param memCfg Database config.
* @param memPlcCfg Memory policy config.
* @param memPlcName Memory policy name.
+ * @throws IgniteCheckedException If failed to initialize swap path.
*/
private void addMemoryPolicy(
MemoryConfiguration memCfg,
MemoryPolicyConfiguration memPlcCfg,
String memPlcName
- ) {
+ ) throws IgniteCheckedException {
String dfltMemPlcName = memCfg.getDefaultMemoryPolicyName();
if (dfltMemPlcName == null)
@@ -844,12 +845,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param plcCfg memory policy with PageMemory specific parameters.
* @param memMetrics {@link MemoryMetrics} object to collect memory usage metrics.
* @return Memory policy instance.
+ *
+ * @throws IgniteCheckedException If failed to initialize swap path.
*/
private MemoryPolicy initMemory(
MemoryConfiguration memCfg,
MemoryPolicyConfiguration plcCfg,
MemoryMetricsImpl memMetrics
- ) {
+ ) throws IgniteCheckedException {
File allocPath = buildAllocPath(plcCfg);
DirectMemoryProvider memProvider = allocPath == null ?
@@ -892,8 +895,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* Builds allocation path for memory mapped file to be used with PageMemory.
*
* @param plc MemoryPolicyConfiguration.
+ *
+ * @throws IgniteCheckedException If resolving swap directory fails.
*/
- @Nullable protected File buildAllocPath(MemoryPolicyConfiguration plc) {
+ @Nullable protected File buildAllocPath(MemoryPolicyConfiguration plc) throws IgniteCheckedException {
String path = plc.getSwapFilePath();
if (path == null)
@@ -938,13 +943,14 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
* @param path Path to the working directory.
* @param consId Consistent ID of the local node.
* @return DB storage path.
+ *
+ * @throws IgniteCheckedException If resolving swap directory fails.
*/
- protected File buildPath(String path, String consId) {
+ protected File buildPath(String path, String consId) throws IgniteCheckedException {
String igniteHomeStr = U.getIgniteHome();
- File igniteHome = igniteHomeStr != null ? new File(igniteHomeStr) : null;
+ File workDir = igniteHomeStr == null ? new File(path) : U.resolveWorkDirectory(igniteHomeStr, path, false);
- File workDir = igniteHome == null ? new File(path) : new File(igniteHome, path);
return new File(workDir, consId);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f749bf4/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
new file mode 100644
index 0000000..53e5daf
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/database/SwapPathConstructionSelfTest.java
@@ -0,0 +1,157 @@
+/*
+ * 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.database;
+
+import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Map;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test verifies correct construction of swap file path {@link MemoryPolicyConfiguration#setSwapFilePath(String)}
+ * when absolute or relative paths are provided via configuration.
+ */
+public class SwapPathConstructionSelfTest extends GridCommonAbstractTest {
+ /** */
+ private MemoryConfiguration memCfg;
+
+ /** */
+ private static final String RELATIVE_SWAP_PATH = "relSwapPath";
+
+ /** */
+ private static final String ABSOLUTE_SWAP_PATH = "absoluteSwapPath";
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setMemoryConfiguration(memCfg);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ cleanUpSwapDir();
+ }
+
+ /**
+ * Cleans up swap files and directories after test.
+ */
+ private void cleanUpSwapDir() {
+ Path relDir = Paths.get(U.getIgniteHome(), RELATIVE_SWAP_PATH);
+
+ deleteRecursively(relDir.toFile());
+
+ Path absDir = Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH);
+
+ deleteRecursively(absDir.toFile());
+ }
+
+ /**
+ * Verifies relative swap file path construction. Directory with swap files is cleaned up during after-test phase.
+ */
+ public void testRelativeSwapFilePath() throws Exception {
+ memCfg = createMemoryConfiguration(true);
+
+ IgniteEx ignite = startGrid(0);
+
+ String allocPath = extractDefaultPageMemoryAllocPath(ignite.context());
+
+ assertNotNull(allocPath);
+
+ assertTrue(allocPath.contains(Paths.get(U.getIgniteHome(), RELATIVE_SWAP_PATH).toString()));
+ }
+
+ /**
+ * Verifies absolute swap file path construction. System tmp directory is used to allocate swap files,
+ * so no clean up is needed.
+ */
+ public void testAbsoluteSwapFilePath() throws Exception {
+ memCfg = createMemoryConfiguration(false);
+
+ IgniteEx ignite = startGrid(0);
+
+ String allocPath = extractDefaultPageMemoryAllocPath(ignite.context());
+
+ assertNotNull(allocPath);
+
+ String expectedPath = Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString();
+
+ assertTrue("Expected path: "
+ + expectedPath
+ + "; actual path: "
+ + allocPath,
+ allocPath.startsWith(expectedPath));
+ }
+
+ /**
+ * @param context Context.
+ */
+ private String extractDefaultPageMemoryAllocPath(GridKernalContext context) {
+ IgniteCacheDatabaseSharedManager dbMgr = context.cache().context().database();
+
+ Map<String, MemoryPolicy> memPlcMap = U.field(dbMgr, "memPlcMap");
+
+ PageMemory pageMem = memPlcMap.get("default").pageMemory();
+
+ Object memProvider = U.field(pageMem, "directMemoryProvider");
+
+ return ((File) U.field(memProvider, "allocationPath")).getAbsolutePath();
+ }
+
+ /**
+ * @param isRelativePath flag is set to {@code true} if relative path should be used for memory policy configuration.
+ */
+ private MemoryConfiguration createMemoryConfiguration(boolean isRelativePath) {
+ MemoryConfiguration memCfg = new MemoryConfiguration();
+
+ MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+
+ memPlcCfg.setName("default");
+ memPlcCfg.setMaxSize(20 * 1024 * 1024);
+
+ if (isRelativePath)
+ memPlcCfg.setSwapFilePath(RELATIVE_SWAP_PATH);
+ else
+ memPlcCfg.setSwapFilePath(Paths.get(getTmpDir(), ABSOLUTE_SWAP_PATH).toString());
+
+ memCfg.setMemoryPolicies(memPlcCfg);
+
+ return memCfg;
+ }
+
+ /**
+ *
+ */
+ private String getTmpDir() {
+ return System.getProperty("java.io.tmpdir");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/6f749bf4/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
index d79e868..2ec2c74 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteBasicTestSuite.java
@@ -20,6 +20,8 @@ package org.apache.ignite.testsuites;
import java.util.Set;
import junit.framework.TestSuite;
import org.apache.ignite.GridSuppressedExceptionSelfTest;
+import org.apache.ignite.internal.processors.database.SwapPathConstructionSelfTest;
+import org.apache.ignite.util.AttributeNodeFilterSelfTest;
import org.apache.ignite.internal.ClusterGroupHostsSelfTest;
import org.apache.ignite.internal.ClusterGroupSelfTest;
import org.apache.ignite.internal.GridFailFastNodeFailureDetectionSelfTest;
@@ -173,6 +175,7 @@ public class IgniteBasicTestSuite extends TestSuite {
suite.addTestSuite(MetadataStorageSelfTest.class);
suite.addTestSuite(FreeListImplSelfTest.class);
suite.addTestSuite(MemoryMetricsSelfTest.class);
+ suite.addTestSuite(SwapPathConstructionSelfTest.class);
suite.addTestSuite(IgniteMarshallerCacheFSRestoreTest.class);
suite.addTestSuite(IgniteMarshallerCacheClassNameConflictTest.class);
[19/19] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-5578
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-5578
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d3ec50a4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d3ec50a4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d3ec50a4
Branch: refs/heads/ignite-5578
Commit: d3ec50a49578cb7f832b55a4928220d292c243f4
Parents: 32c94ed de259ff
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 26 13:52:39 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 26 13:52:39 2017 +0300
----------------------------------------------------------------------
LICENSE | 7 +
.../ml/math/matrix/ExampleMatrixStorage.java | 6 +-
.../dht/GridClientPartitionTopology.java | 9 +-
.../dht/GridDhtPartitionTopologyImpl.java | 9 +-
.../IgniteCacheDatabaseSharedManager.java | 22 +-
.../platform/PlatformAbstractTarget.java | 6 +-
.../processors/platform/PlatformIgnition.java | 5 +-
.../platform/PlatformNoopProcessor.java | 132 -----
.../processors/platform/PlatformProcessor.java | 216 --------
.../platform/PlatformProcessorImpl.java | 554 +++++++++++--------
.../platform/cluster/PlatformClusterGroup.java | 29 +
.../datastructures/PlatformAtomicReference.java | 13 +-
.../database/SwapPathConstructionSelfTest.java | 157 ++++++
.../ignite/testsuites/IgniteBasicTestSuite.java | 3 +
modules/ml/README.txt | 6 +
modules/ml/licenses/bsd3.txt | 51 ++
modules/ml/pom.xml | 22 +
.../clustering/KMeansDistributedClusterer.java | 6 +-
.../ml/clustering/KMeansLocalClusterer.java | 2 +-
.../java/org/apache/ignite/ml/math/Blas.java | 484 ++++++++++++++++
.../org/apache/ignite/ml/math/MathUtils.java | 1 +
.../java/org/apache/ignite/ml/math/Matrix.java | 31 ++
.../apache/ignite/ml/math/MatrixStorage.java | 2 +-
.../apache/ignite/ml/math/OrderedMatrix.java | 24 +
.../java/org/apache/ignite/ml/math/Vector.java | 8 +
.../org/apache/ignite/ml/math/VectorUtils.java | 7 +-
.../decompositions/CholeskyDecomposition.java | 11 +-
.../ml/math/decompositions/LUDecomposition.java | 2 +-
.../ml/math/decompositions/QRDecomposition.java | 2 +-
.../exceptions/MathIllegalNumberException.java | 8 +-
.../IgniteIntDoubleToDoubleBiFunction.java | 27 +
.../functions/IgniteIntIntToIntBiFunction.java | 27 +
.../ml/math/functions/IgniteTriFunction.java | 35 ++
.../apache/ignite/ml/math/impls/CacheUtils.java | 4 +-
.../ml/math/impls/matrix/AbstractMatrix.java | 96 +++-
.../impls/matrix/DenseLocalOnHeapMatrix.java | 61 +-
.../impls/matrix/SparseLocalOnHeapMatrix.java | 27 +
.../storage/matrix/ArrayMatrixStorage.java | 78 ++-
.../matrix/DenseOffHeapMatrixStorage.java | 4 +-
.../storage/matrix/MatrixDelegateStorage.java | 2 +-
.../matrix/SparseDistributedMatrixStorage.java | 4 +-
.../matrix/SparseLocalOnHeapMatrixStorage.java | 18 +
.../vector/DenseLocalOffHeapVectorStorage.java | 2 +-
.../vector/SparseLocalOffHeapVectorStorage.java | 2 +-
.../vector/SparseLocalOnHeapVectorStorage.java | 10 +-
.../impls/vector/AbstractReadOnlyVector.java | 6 +
.../ml/math/impls/vector/AbstractVector.java | 8 +
.../ml/math/impls/vector/CacheVector.java | 4 +-
.../ml/math/impls/vector/DelegatingVector.java | 6 +
.../ml/math/impls/vector/MapWrapperVector.java | 1 -
.../ml/math/impls/vector/SparseLocalVector.java | 45 +-
.../ignite/ml/math/impls/vector/VectorView.java | 2 +-
.../apache/ignite/ml/math/util/MatrixUtil.java | 52 +-
.../AbstractMultipleLinearRegression.java | 4 +-
.../OLSMultipleLinearRegression.java | 2 +-
.../java/org/apache/ignite/ml/TestUtils.java | 2 +-
.../KMeansDistributedClustererTest.java | 15 +-
.../org/apache/ignite/ml/math/BlasTest.java | 357 ++++++++++++
.../ignite/ml/math/MathImplMainTestSuite.java | 3 +-
.../ignite/ml/math/benchmark/MathBenchmark.java | 2 +-
.../ml/math/benchmark/VectorBenchmarkTest.java | 2 +-
.../decompositions/EigenDecompositionTest.java | 2 +-
.../math/impls/matrix/MatrixAttributeTest.java | 2 -
.../impls/matrix/MatrixViewConstructorTest.java | 2 +-
.../storage/matrix/MatrixArrayStorageTest.java | 6 +-
.../matrix/MatrixStorageImplementationTest.java | 2 +-
.../math/impls/vector/AbstractVectorTest.java | 4 +-
.../PivotedVectorViewConstructorTest.java | 2 +-
.../math/impls/vector/VectorAttributesTest.java | 2 +-
.../ml/math/impls/vector/VectorFoldMapTest.java | 2 +-
.../impls/vector/VectorImplementationsTest.java | 12 +-
.../math/impls/vector/VectorIterableTest.java | 2 +-
.../math/impls/vector/VectorToMatrixTest.java | 4 +-
.../OLSMultipleLinearRegressionTest.java | 4 +-
.../platforms/cpp/core/include/ignite/ignite.h | 6 +-
.../include/ignite/impl/compute/compute_impl.h | 5 +-
.../cpp/core/include/ignite/impl/ignite_impl.h | 112 ++--
.../ignite/impl/interop/interop_target.h | 16 +-
modules/platforms/cpp/core/src/ignition.cpp | 23 +-
.../cpp/core/src/impl/ignite_environment.cpp | 37 +-
.../platforms/cpp/core/src/impl/ignite_impl.cpp | 25 +-
.../core/src/impl/interop/interop_target.cpp | 18 +-
.../cpp/jni/include/ignite/jni/exports.h | 31 +-
.../platforms/cpp/jni/include/ignite/jni/java.h | 70 +--
modules/platforms/cpp/jni/project/vs/module.def | 30 +-
modules/platforms/cpp/jni/src/exports.cpp | 116 +---
modules/platforms/cpp/jni/src/java.cpp | 518 +----------------
.../dotnet/Apache.Ignite.Core/Ignition.cs | 12 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 2 +-
.../Impl/Cluster/ClusterGroupImpl.cs | 78 ++-
.../Impl/Compute/ComputeImpl.cs | 6 +-
.../Impl/Datastream/DataStreamerImpl.cs | 3 +-
.../Impl/Datastream/StreamReceiverHolder.cs | 2 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 279 +++++-----
.../Apache.Ignite.Core/Impl/Log/JavaLogger.cs | 23 +-
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 18 +-
.../Impl/Plugin/PluginContext.cs | 7 +-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 91 +--
.../Impl/Unmanaged/UnmanagedUtils.cs | 308 +----------
modules/web-console/backend/.eslintrc | 39 +-
modules/web-console/backend/app/agentSocket.js | 4 +-
.../web-console/backend/app/browsersHandler.js | 2 +-
modules/web-console/backend/package.json | 27 +-
modules/web-console/frontend/.eslintrc | 40 +-
modules/web-console/frontend/app/app.js | 45 +-
.../components/activities-user-dialog/index.js | 28 +-
.../page-configure-advanced/controller.js | 9 +-
.../components/page-configure-basic/service.js | 8 +-
.../app/components/page-configure/controller.js | 12 +-
.../page-configure/controller.spec.js | 48 --
.../page-configure/services/PageConfigure.js | 18 +-
.../components/web-console-header/component.js | 12 +-
.../app/components/web-console-header/index.js | 4 +-
.../components/web-console-header/style.scss | 6 +-
.../frontend/app/decorator/select.js | 77 ---
.../frontend/app/decorator/tooltip.js | 73 ---
.../frontend/app/modules/ace.module.js | 6 +-
.../app/modules/branding/branding.module.js | 16 +-
.../generator/ConfigurationGenerator.js | 2 +-
.../generator/PlatformGenerator.js | 4 +-
.../frontend/app/modules/demo/Demo.module.js | 10 +-
.../app/modules/dialog/dialog.controller.js | 4 -
.../app/modules/form/field/label.directive.js | 4 +-
.../app/modules/form/field/tooltip.directive.js | 4 +-
.../frontend/app/modules/sql/sql.controller.js | 2 +-
.../frontend/app/modules/sql/sql.module.js | 66 ++-
.../frontend/app/modules/states/admin.state.js | 6 +-
.../app/modules/states/configuration.state.js | 35 +-
.../states/configuration/clusters/memory.pug | 8 +-
.../summary/summary-zipper.service.js | 2 +-
.../frontend/app/modules/states/errors.state.js | 4 +-
.../frontend/app/modules/states/logout.state.js | 12 +-
.../app/modules/states/password.state.js | 4 +-
.../app/modules/states/profile.state.js | 9 +-
.../frontend/app/modules/states/signin.state.js | 32 +-
.../app/modules/user/AclRoute.provider.js | 6 +-
.../frontend/app/modules/user/user.module.js | 30 +-
.../frontend/app/primitives/modal/index.scss | 9 +
.../frontend/app/primitives/panel/index.scss | 2 +-
.../services/AngularStrapSelect.decorator.js | 77 +++
.../services/AngularStrapTooltip.decorator.js | 103 ++++
.../app/services/CopyToClipboard.service.js | 4 +-
.../app/services/LegacyTable.service.js | 2 +-
modules/web-console/frontend/app/vendor.js | 8 +-
modules/web-console/frontend/package.json | 57 +-
.../views/configuration/domains-import.tpl.pug | 4 +-
.../frontend/views/includes/header-left.pug | 41 +-
modules/web-console/frontend/views/index.pug | 14 +-
.../console/agent/handlers/RestListener.java | 7 +-
.../ignite/console/agent/rest/RestExecutor.java | 49 +-
150 files changed, 3024 insertions(+), 2696 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3ec50a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d3ec50a4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
[02/19] ignite git commit: Revert "removed excluding ML sources from
assembly file - Fixes #2310."
Posted by sb...@apache.org.
Revert "removed excluding ML sources from assembly file - Fixes #2310."
This reverts commit 219f28948d22a36f9292ae34b02e18171486d3cc.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e88fcd8d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e88fcd8d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e88fcd8d
Branch: refs/heads/ignite-5578
Commit: e88fcd8d228e2f15187ff05218f3afb242c65fed
Parents: 219f289
Author: devozerov <vo...@gridgain.com>
Authored: Mon Jul 17 17:13:16 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Mon Jul 17 17:13:16 2017 +0300
----------------------------------------------------------------------
assembly/release-fabric-base.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e88fcd8d/assembly/release-fabric-base.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric-base.xml b/assembly/release-fabric-base.xml
index 5007785..7484dfa 100644
--- a/assembly/release-fabric-base.xml
+++ b/assembly/release-fabric-base.xml
@@ -239,6 +239,7 @@
<excludes>
<exclude>**/package.html</exclude>
<exclude>src/test/**</exclude>
+ <exclude>src/main/ml/**</exclude>
</excludes>
</fileSet>
[08/19] ignite git commit: IGNITE-5812 Set width for dropdown as for
element.
Posted by sb...@apache.org.
IGNITE-5812 Set width for dropdown as for element.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39fa8fae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39fa8fae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39fa8fae
Branch: refs/heads/ignite-5578
Commit: 39fa8fae3ec80fd3a4c07f4610ab46817b75dd23
Parents: 0d2992c
Author: Dmitriy Shabalin <ds...@gridgain.com>
Authored: Tue Jul 25 14:30:47 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Tue Jul 25 14:30:47 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.js | 8 +-
.../frontend/app/decorator/select.js | 77 --------------
.../frontend/app/decorator/tooltip.js | 73 -------------
.../services/AngularStrapSelect.decorator.js | 77 ++++++++++++++
.../services/AngularStrapTooltip.decorator.js | 103 +++++++++++++++++++
.../views/configuration/domains-import.tpl.pug | 4 +-
6 files changed, 186 insertions(+), 156 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index dc5c6e9..0667e8f 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -20,9 +20,6 @@ import '../app/primitives';
import './app.config';
-import './decorator/select';
-import './decorator/tooltip';
-
import './modules/form/form.module';
import './modules/agent/agent.module';
import './modules/sql/sql.module';
@@ -97,6 +94,9 @@ import UnsavedChangesGuard from './services/UnsavedChangesGuard.service';
import Clusters from './services/Clusters';
import Caches from './services/Caches';
+import AngularStrapTooltip from './services/AngularStrapTooltip.decorator';
+import AngularStrapSelect from './services/AngularStrapSelect.decorator';
+
// Filters.
import byName from './filters/byName.filter';
import defaultName from './filters/default-name.filter';
@@ -195,6 +195,8 @@ angular
gridColumnSelector.name,
bsSelectMenu.name,
protectFromBsSelectRender.name,
+ AngularStrapTooltip.name,
+ AngularStrapSelect.name,
// Ignite modules.
IgniteModules.name
])
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/app/decorator/select.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/decorator/select.js b/modules/web-console/frontend/app/decorator/select.js
deleted file mode 100644
index 2d22707..0000000
--- a/modules/web-console/frontend/app/decorator/select.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-import angular from 'angular';
-
-/**
- * Special decorator that fix problem in AngularStrap selectAll / deselectAll methods.
- * If this problem will be fixed in AngularStrap we can remove this delegate.
- */
-angular.module('mgcrea.ngStrap.select')
- .decorator('$select', ['$delegate', ($delegate) => {
- function SelectFactoryDecorated(element, controller, config) {
- const delegate = $delegate(element, controller, config);
-
- // Common vars.
- const options = angular.extend({}, $delegate.defaults, config);
-
- const scope = delegate.$scope;
-
- const valueByIndex = (index) => {
- if (angular.isUndefined(scope.$matches[index]))
- return null;
-
- return scope.$matches[index].value;
- };
-
- const selectAll = (active) => {
- const selected = [];
-
- scope.$apply(() => {
- for (let i = 0; i < scope.$matches.length; i++) {
- if (scope.$isActive(i) === active) {
- selected[i] = scope.$matches[i].value;
-
- delegate.activate(i);
-
- controller.$setViewValue(scope.$activeIndex.map(valueByIndex));
- }
- }
- });
-
- // Emit events.
- for (let i = 0; i < selected.length; i++) {
- if (selected[i])
- scope.$emit(options.prefixEvent + '.select', selected[i], i, delegate);
- }
- };
-
- scope.$selectAll = () => {
- scope.$$postDigest(selectAll.bind(this, false));
- };
-
- scope.$selectNone = () => {
- scope.$$postDigest(selectAll.bind(this, true));
- };
-
- return delegate;
- }
-
- SelectFactoryDecorated.defaults = $delegate.defaults;
-
- return SelectFactoryDecorated;
- }]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/app/decorator/tooltip.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/decorator/tooltip.js b/modules/web-console/frontend/app/decorator/tooltip.js
deleted file mode 100644
index 71ea694..0000000
--- a/modules/web-console/frontend/app/decorator/tooltip.js
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-import angular from 'angular';
-
-/**
- * Special decorator that fix problem in AngularStrap $tooltip in special case.
- * Case: when tooltip is shown on table row remove button and user click this button.
- * If this problem will be fixed in AngularStrap we can remove this delegate.
- */
-angular.module('mgcrea.ngStrap.tooltip')
- .decorator('$tooltip', ['$delegate', ($delegate) => {
- function TooltipFactoryDecorated(element, config) {
- let tipElementEntered = false;
-
- config.onShow = ($tooltip) => {
- // Workaround for tooltip detection.
- if ($tooltip.$element && $tooltip.$options.trigger === 'click hover') {
- $tooltip.$element.on('mouseenter', () => tipElementEntered = true);
- $tooltip.$element.on('mouseleave', () => {
- tipElementEntered = false;
-
- $tooltip.leave();
- });
- }
- };
-
- const $tooltip = $delegate(element, config);
-
- const scope = $tooltip.$scope;
- const options = $tooltip.$options;
-
- const _hide = $tooltip.hide;
-
- $tooltip.hide = (blur) => {
- if (!$tooltip.$isShown || tipElementEntered)
- return;
-
- if ($tooltip.$element) {
- $tooltip.$element.off('mouseenter');
- $tooltip.$element.off('mouseleave');
-
- return _hide(blur);
- }
-
- scope.$emit(options.prefixEvent + '.hide.before', $tooltip);
-
- if (angular.isDefined(options.onBeforeHide) && angular.isFunction(options.onBeforeHide))
- options.onBeforeHide($tooltip);
-
- $tooltip.$isShown = scope.$isShown = false;
- scope.$$phase || (scope.$root && scope.$root.$$phase) || scope.$digest();
- };
-
- return $tooltip;
- }
-
- return TooltipFactoryDecorated;
- }]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/app/services/AngularStrapSelect.decorator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/AngularStrapSelect.decorator.js b/modules/web-console/frontend/app/services/AngularStrapSelect.decorator.js
new file mode 100644
index 0000000..39f7ccd
--- /dev/null
+++ b/modules/web-console/frontend/app/services/AngularStrapSelect.decorator.js
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+
+/**
+ * Special decorator that fix problem in AngularStrap selectAll / deselectAll methods.
+ * If this problem will be fixed in AngularStrap we can remove this delegate.
+ */
+export default angular.module('mgcrea.ngStrap.select')
+ .decorator('$select', ['$delegate', ($delegate) => {
+ function SelectFactoryDecorated(element, controller, config) {
+ const delegate = $delegate(element, controller, config);
+
+ // Common vars.
+ const options = angular.extend({}, $delegate.defaults, config);
+
+ const scope = delegate.$scope;
+
+ const valueByIndex = (index) => {
+ if (angular.isUndefined(scope.$matches[index]))
+ return null;
+
+ return scope.$matches[index].value;
+ };
+
+ const selectAll = (active) => {
+ const selected = [];
+
+ scope.$apply(() => {
+ for (let i = 0; i < scope.$matches.length; i++) {
+ if (scope.$isActive(i) === active) {
+ selected[i] = scope.$matches[i].value;
+
+ delegate.activate(i);
+
+ controller.$setViewValue(scope.$activeIndex.map(valueByIndex));
+ }
+ }
+ });
+
+ // Emit events.
+ for (let i = 0; i < selected.length; i++) {
+ if (selected[i])
+ scope.$emit(options.prefixEvent + '.select', selected[i], i, delegate);
+ }
+ };
+
+ scope.$selectAll = () => {
+ scope.$$postDigest(selectAll.bind(this, false));
+ };
+
+ scope.$selectNone = () => {
+ scope.$$postDigest(selectAll.bind(this, true));
+ };
+
+ return delegate;
+ }
+
+ SelectFactoryDecorated.defaults = $delegate.defaults;
+
+ return SelectFactoryDecorated;
+ }]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/app/services/AngularStrapTooltip.decorator.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/AngularStrapTooltip.decorator.js b/modules/web-console/frontend/app/services/AngularStrapTooltip.decorator.js
new file mode 100644
index 0000000..d01a450
--- /dev/null
+++ b/modules/web-console/frontend/app/services/AngularStrapTooltip.decorator.js
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+
+import angular from 'angular';
+import flow from 'lodash/flow';
+
+/**
+ * Decorator that fix problem in AngularStrap $tooltip.
+ */
+export default angular
+ .module('mgcrea.ngStrap.tooltip')
+ /**
+ * Don't hide tooltip when mouse move from element to tooltip.
+ */
+ .decorator('$tooltip', ['$delegate', ($delegate) => {
+ function TooltipFactoryDecorated(element, config) {
+ let tipElementEntered = false;
+
+ config.onShow = ($tooltip) => {
+ // Workaround for tooltip detection.
+ if ($tooltip.$element && $tooltip.$options.trigger === 'click hover') {
+ $tooltip.$element.on('mouseenter', () => tipElementEntered = true);
+ $tooltip.$element.on('mouseleave', () => {
+ tipElementEntered = false;
+
+ $tooltip.leave();
+ });
+ }
+ };
+
+ const $tooltip = $delegate(element, config);
+
+ const scope = $tooltip.$scope;
+ const options = $tooltip.$options;
+
+ const _hide = $tooltip.hide;
+
+ $tooltip.hide = (blur) => {
+ if (!$tooltip.$isShown || tipElementEntered)
+ return;
+
+ if ($tooltip.$element) {
+ $tooltip.$element.off('mouseenter');
+ $tooltip.$element.off('mouseleave');
+
+ return _hide(blur);
+ }
+
+ scope.$emit(options.prefixEvent + '.hide.before', $tooltip);
+
+ if (angular.isDefined(options.onBeforeHide) && angular.isFunction(options.onBeforeHide))
+ options.onBeforeHide($tooltip);
+
+ $tooltip.$isShown = scope.$isShown = false;
+ scope.$$phase || (scope.$root && scope.$root.$$phase) || scope.$digest();
+ };
+
+ return $tooltip;
+ }
+
+ return TooltipFactoryDecorated;
+ }])
+ /**
+ * Set width for dropdown as for element.
+ */
+ .decorator('$tooltip', ['$delegate', ($delegate) => {
+ return function(el, config) {
+ const $tooltip = $delegate(el, config);
+
+ $tooltip.$referenceElement = el;
+ $tooltip.destroy = flow($tooltip.destroy, () => $tooltip.$referenceElement = null);
+ $tooltip.$applyPlacement = flow($tooltip.$applyPlacement, () => {
+ if (!$tooltip.$element)
+ return;
+
+ const refWidth = $tooltip.$referenceElement[0].getBoundingClientRect().width;
+ const elWidth = $tooltip.$element[0].getBoundingClientRect().width;
+
+ if (refWidth > elWidth) {
+ $tooltip.$element.css({
+ width: refWidth,
+ maxWidth: 'initial'
+ });
+ }
+ });
+
+ return $tooltip;
+ };
+ }]);
http://git-wip-us.apache.org/repos/asf/ignite/blob/39fa8fae/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
index 7097197..e9ed6f3 100644
--- a/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
+++ b/modules/web-console/frontend/views/configuration/domains-import.tpl.pug
@@ -65,13 +65,11 @@ mixin td-ellipses-lbl(w, lbl)
+ignite-form-field-dropdown('Driver JAR:', 'ui.selectedJdbcDriverJar', '"jdbcDriverJar"', false, true, false,
'Choose JDBC driver', '', 'jdbcDriverJars',
'Select appropriate JAR with JDBC driver<br> To add another driver you need to place it into "/jdbc-drivers" folder of Ignite Web Agent<br> Refer to Ignite Web Agent README.txt for for more information'
- )(
- data-ignite-form-field-input-autofocus='true'
)
.settings-row.settings-row_small-label
+java-class('JDBC driver:', 'selectedPreset.jdbcDriverClass', '"jdbcDriverClass"', true, true, 'Fully qualified class name of JDBC driver that will be used to connect to database')
.settings-row.settings-row_small-label
- +text('JDBC URL:', 'selectedPreset.jdbcUrl', '"jdbcUrl"', true, 'JDBC URL', 'JDBC URL for connecting to database<br>Refer to your database documentation for details')
+ +text-enabled-autofocus('JDBC URL:', 'selectedPreset.jdbcUrl', '"jdbcUrl"', true, true, 'JDBC URL', 'JDBC URL for connecting to database<br>Refer to your database documentation for details')
.settings-row.settings-row_small-label
+text('User:', 'selectedPreset.user', '"jdbcUser"', false, '', 'User name for connecting to database')
.settings-row.settings-row_small-label
[04/19] ignite git commit: Fixed checking full map on updates.
Posted by sb...@apache.org.
Fixed checking full map on updates.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/95f4abc7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/95f4abc7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/95f4abc7
Branch: refs/heads/ignite-5578
Commit: 95f4abc709bcf2a4534f9631b3ecea8266cfc485
Parents: 6f749bf
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Fri Jul 21 18:03:07 2017 +0300
Committer: Pavel Kovalenko <jo...@gmail.com>
Committed: Fri Jul 21 18:03:44 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridClientPartitionTopology.java | 9 +++++++--
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 9 +++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/95f4abc7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index f4ed517..6ff572b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -628,8 +628,13 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
}
- for (GridDhtPartitionMap part : partMap.values())
- fullMapUpdated |= !node2part.containsKey(part);
+ // Check that we have new nodes.
+ for (GridDhtPartitionMap part : partMap.values()) {
+ if (fullMapUpdated)
+ break;
+
+ fullMapUpdated = !node2part.containsKey(part.nodeId());
+ }
// Remove entry if node left.
for (Iterator<UUID> it = partMap.keySet().iterator(); it.hasNext(); ) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/95f4abc7/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 601da1b..0ca291d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -1154,8 +1154,13 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
- for (GridDhtPartitionMap part : partMap.values())
- fullMapUpdated |= !node2part.containsKey(part);
+ // Check that we have new nodes.
+ for (GridDhtPartitionMap part : partMap.values()) {
+ if (fullMapUpdated)
+ break;
+
+ fullMapUpdated = !node2part.containsKey(part.nodeId());
+ }
// Remove entry if node left.
for (Iterator<UUID> it = partMap.keySet().iterator(); it.hasNext(); ) {
[12/19] ignite git commit: IGNITE-5770 Refactor PlatformProcessor to
PlatformTarget mechanism
Posted by sb...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/bdc9e4b9/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
index f76bbac..a38cf2f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
@@ -93,12 +93,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
try
{
- // OnStart receives the same InteropProcessor as here (just as another GlobalRef) and stores it.
- // Release current reference immediately.
- void* res = JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId,
+ // OnStart receives InteropProcessor referece and stores it.
+ JNI.IgnitionStart(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId,
mem.SynchronizeOutput());
-
- JNI.Release(res);
}
finally
{
@@ -122,304 +119,6 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
}
}
- internal static void IgnitionStopAll(void* ctx, bool cancel)
- {
- JNI.IgnitionStopAll(ctx, cancel);
- }
-
- internal static void ProcessorReleaseStart(IUnmanagedTarget target)
- {
- JNI.ProcessorReleaseStart(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget ProcessorProjection(IUnmanagedTarget target)
- {
- void* res = JNI.ProcessorProjection(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorCache(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorCreateCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorCreateCache(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorCreateCache(IUnmanagedTarget target, long memPtr)
- {
- void* res = JNI.ProcessorCreateCacheFromConfig(target.Context, target.Target, memPtr);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorGetOrCreateCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorGetOrCreateCache(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorGetOrCreateCache(IUnmanagedTarget target, long memPtr)
- {
- void* res = JNI.ProcessorGetOrCreateCacheFromConfig(target.Context, target.Target, memPtr);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorCreateNearCache(IUnmanagedTarget target, string name, long memPtr)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorCreateNearCache(target.Context, target.Target, name0, memPtr);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorGetOrCreateNearCache(IUnmanagedTarget target, string name, long memPtr)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorGetOrCreateNearCache(target.Context, target.Target, name0, memPtr);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static void ProcessorDestroyCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- JNI.ProcessorDestroyCache(target.Context, target.Target, name0);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorAffinity(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorAffinity(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorDataStreamer(IUnmanagedTarget target, string name, bool keepBinary)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = JNI.ProcessorDataStreamer(target.Context, target.Target, name0, keepBinary);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorTransactions(IUnmanagedTarget target)
- {
- void* res = JNI.ProcessorTransactions(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorCompute(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = JNI.ProcessorCompute(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorMessage(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = JNI.ProcessorMessage(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorEvents(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = JNI.ProcessorEvents(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorServices(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = JNI.ProcessorServices(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorExtensions(IUnmanagedTarget target)
- {
- void* res = JNI.ProcessorExtensions(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorExtension(IUnmanagedTarget target, int id)
- {
- void* res = JNI.ProcessorExtension(target.Context, target.Target, id);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorAtomicLong(IUnmanagedTarget target, string name, long initialValue,
- bool create)
- {
- var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- var res = JNI.ProcessorAtomicLong(target.Context, target.Target, name0, initialValue, create);
-
- return res == null ? null : target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorAtomicSequence(IUnmanagedTarget target, string name, long initialValue,
- bool create)
- {
- var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- var res = JNI.ProcessorAtomicSequence(target.Context, target.Target, name0, initialValue, create);
-
- return res == null ? null : target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorAtomicReference(IUnmanagedTarget target, string name, long memPtr,
- bool create)
- {
- var name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- var res = JNI.ProcessorAtomicReference(target.Context, target.Target, name0, memPtr, create);
-
- return res == null ? null : target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static void ProcessorGetIgniteConfiguration(IUnmanagedTarget target, long memPtr)
- {
- JNI.ProcessorGetIgniteConfiguration(target.Context, target.Target, memPtr);
- }
-
- internal static void ProcessorGetCacheNames(IUnmanagedTarget target, long memPtr)
- {
- JNI.ProcessorGetCacheNames(target.Context, target.Target, memPtr);
- }
-
- internal static bool ProcessorLoggerIsLevelEnabled(IUnmanagedTarget target, int level)
- {
- return JNI.ProcessorLoggerIsLevelEnabled(target.Context, target.Target, level);
- }
-
- internal static void ProcessorLoggerLog(IUnmanagedTarget target, int level, string message, string category,
- string errorInfo)
- {
- var message0 = IgniteUtils.StringToUtf8Unmanaged(message);
- var category0 = IgniteUtils.StringToUtf8Unmanaged(category);
- var errorInfo0 = IgniteUtils.StringToUtf8Unmanaged(errorInfo);
-
- try
- {
- JNI.ProcessorLoggerLog(target.Context, target.Target, level, message0, category0, errorInfo0);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(message0));
- Marshal.FreeHGlobal(new IntPtr(category0));
- Marshal.FreeHGlobal(new IntPtr(errorInfo0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorBinaryProcessor(IUnmanagedTarget target)
- {
- void* res = JNI.ProcessorBinaryProcessor(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
#endregion
#region NATIVE METHODS: TARGET
@@ -443,6 +142,9 @@ namespace Apache.Ignite.Core.Impl.Unmanaged
{
void* res = JNI.TargetInStreamOutObject(target.Context, target.Target, opType, inMemPtr);
+ if (res == null)
+ return null;
+
return target.ChangeTarget(res);
}
[18/19] ignite git commit: 5578
Posted by sb...@apache.org.
5578
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/32c94ed1
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/32c94ed1
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/32c94ed1
Branch: refs/heads/ignite-5578
Commit: 32c94ed18fbed83c3ee200aa1ef99e8e105e52e0
Parents: 39f668e
Author: sboikov <sb...@gridgain.com>
Authored: Wed Jul 26 13:52:28 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Jul 26 13:52:28 2017 +0300
----------------------------------------------------------------------
.../processors/cache/distributed/dht/GridDhtLocalPartition.java | 3 +++
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/32c94ed1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index 725822d..a4c479f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -33,6 +33,7 @@ import java.util.concurrent.locks.ReentrantLock;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.TestDebugLog;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.NodeStoppingException;
@@ -203,6 +204,8 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
rmvdEntryTtl = Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000);
+ TestDebugLog.addPartMessage(id, ctx.localNodeId(), "created");
+
try {
store = grp.offheap().createCacheDataStore(id);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/32c94ed1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index d82d091..e03bf61 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -1464,7 +1464,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
AffinityTopologyVersion affVer = grp.affinity().lastVersion();
if (affVer.compareTo(diffFromAffinityVer) >= 0) {
- AffinityAssignment affAssignment = grp.affinity().cachedAffinity(affVer);
+ AffinityAssignment affAssignment = grp.affinity().readyAffinity(affVer);
// Add new mappings.
for (Map.Entry<Integer, GridDhtPartitionState> e : parts.entrySet()) {