Return-Path:
X-Original-To: apmail-ignite-commits-archive@minotaur.apache.org
Delivered-To: apmail-ignite-commits-archive@minotaur.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id 9A84217F8C
for ;
Thu, 5 Nov 2015 13:15:54 +0000 (UTC)
Received: (qmail 1182 invoked by uid 500); 5 Nov 2015 13:15:54 -0000
Delivered-To: apmail-ignite-commits-archive@ignite.apache.org
Received: (qmail 1103 invoked by uid 500); 5 Nov 2015 13:15:54 -0000
Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@ignite.apache.org
Delivered-To: mailing list commits@ignite.apache.org
Received: (qmail 591 invoked by uid 99); 5 Nov 2015 13:15:53 -0000
Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org)
(140.211.11.23)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2015 13:15:53 +0000
Received: by git1-us-west.apache.org (ASF Mail Server at
git1-us-west.apache.org, from userid 33)
id 48D47E390B; Thu, 5 Nov 2015 13:15:53 +0000 (UTC)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: agoncharuk@apache.org
To: commits@ignite.apache.org
Date: Thu, 05 Nov 2015 13:16:01 -0000
Message-Id: <875aaaddd331446298aa3c599ad98a4b@git.apache.org>
In-Reply-To: <1fde8345cf7b41f58211e2c5b798ae8c@git.apache.org>
References: <1fde8345cf7b41f58211e2c5b798ae8c@git.apache.org>
X-Mailer: ASF-Git Admin Mailer
Subject: [09/26] ignite git commit: Merged IGNITE-950-new into IGNITE-1282
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
index 7a08ef5..4c0921a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java
@@ -24,8 +24,8 @@ import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CachePeekMode;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.portable.PortableRawReaderEx;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.portable.BinaryRawReaderEx;
+import org.apache.ignite.internal.portable.BinaryRawWriterEx;
import org.apache.ignite.internal.processors.platform.PlatformContext;
import org.apache.ignite.internal.processors.platform.PlatformExtendedException;
import org.apache.ignite.internal.processors.platform.PlatformNativeException;
@@ -96,7 +96,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param col Collection to write.
*/
- public static void writeNullableCollection(PortableRawWriterEx writer, @Nullable Collection col) {
+ public static void writeNullableCollection(BinaryRawWriterEx writer, @Nullable Collection col) {
writeNullableCollection(writer, col, null, null);
}
@@ -107,7 +107,7 @@ public class PlatformUtils {
* @param col Collection to write.
* @param writeClo Writer closure.
*/
- public static void writeNullableCollection(PortableRawWriterEx writer, @Nullable Collection col,
+ public static void writeNullableCollection(BinaryRawWriterEx writer, @Nullable Collection col,
@Nullable PlatformWriterClosure writeClo) {
writeNullableCollection(writer, col, writeClo, null);
}
@@ -120,7 +120,7 @@ public class PlatformUtils {
* @param writeClo Optional writer closure.
* @param filter Optional filter.
*/
- public static void writeNullableCollection(PortableRawWriterEx writer, @Nullable Collection col,
+ public static void writeNullableCollection(BinaryRawWriterEx writer, @Nullable Collection col,
@Nullable PlatformWriterClosure writeClo, @Nullable IgnitePredicate filter) {
if (col != null) {
writer.writeBoolean(true);
@@ -137,7 +137,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param col Collection to write.
*/
- public static void writeCollection(PortableRawWriterEx writer, Collection col) {
+ public static void writeCollection(BinaryRawWriterEx writer, Collection col) {
writeCollection(writer, col, null, null);
}
@@ -148,7 +148,7 @@ public class PlatformUtils {
* @param col Collection to write.
* @param writeClo Writer closure.
*/
- public static void writeCollection(PortableRawWriterEx writer, Collection col,
+ public static void writeCollection(BinaryRawWriterEx writer, Collection col,
@Nullable PlatformWriterClosure writeClo) {
writeCollection(writer, col, writeClo, null);
}
@@ -161,7 +161,7 @@ public class PlatformUtils {
* @param writeClo Optional writer closure.
* @param filter Optional filter.
*/
- public static void writeCollection(PortableRawWriterEx writer, Collection col,
+ public static void writeCollection(BinaryRawWriterEx writer, Collection col,
@Nullable PlatformWriterClosure writeClo, @Nullable IgnitePredicate filter) {
assert col != null;
@@ -202,7 +202,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param map Map to write.
*/
- public static void writeNullableMap(PortableRawWriterEx writer, @Nullable Map map) {
+ public static void writeNullableMap(BinaryRawWriterEx writer, @Nullable Map map) {
if (map != null) {
writer.writeBoolean(true);
@@ -218,7 +218,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param map Map to write.
*/
- public static void writeMap(PortableRawWriterEx writer, Map map) {
+ public static void writeMap(BinaryRawWriterEx writer, Map map) {
assert map != null;
writeMap(writer, map, null);
@@ -231,7 +231,7 @@ public class PlatformUtils {
* @param map Map to write.
* @param writeClo Writer closure.
*/
- public static void writeMap(PortableRawWriterEx writer, Map map,
+ public static void writeMap(BinaryRawWriterEx writer, Map map,
@Nullable PlatformWriterBiClosure writeClo) {
assert map != null;
@@ -255,7 +255,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return List.
*/
- public static List readCollection(PortableRawReaderEx reader) {
+ public static List readCollection(BinaryRawReaderEx reader) {
return readCollection(reader, null);
}
@@ -266,7 +266,7 @@ public class PlatformUtils {
* @param readClo Optional reader closure.
* @return List.
*/
- public static List readCollection(PortableRawReaderEx reader, @Nullable PlatformReaderClosure readClo) {
+ public static List readCollection(BinaryRawReaderEx reader, @Nullable PlatformReaderClosure readClo) {
int cnt = reader.readInt();
List res = new ArrayList<>(cnt);
@@ -289,7 +289,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return List.
*/
- public static List readNullableCollection(PortableRawReaderEx reader) {
+ public static List readNullableCollection(BinaryRawReaderEx reader) {
return readNullableCollection(reader, null);
}
@@ -299,7 +299,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return List.
*/
- public static List readNullableCollection(PortableRawReaderEx reader,
+ public static List readNullableCollection(BinaryRawReaderEx reader,
@Nullable PlatformReaderClosure readClo) {
if (!reader.readBoolean())
return null;
@@ -311,7 +311,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return Set.
*/
- public static Set readSet(PortableRawReaderEx reader) {
+ public static Set readSet(BinaryRawReaderEx reader) {
int cnt = reader.readInt();
Set res = U.newHashSet(cnt);
@@ -326,7 +326,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return Set.
*/
- public static Set readNullableSet(PortableRawReaderEx reader) {
+ public static Set readNullableSet(BinaryRawReaderEx reader) {
if (!reader.readBoolean())
return null;
@@ -339,7 +339,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return Map.
*/
- public static Map readMap(PortableRawReaderEx reader) {
+ public static Map readMap(BinaryRawReaderEx reader) {
return readMap(reader, null);
}
@@ -350,7 +350,7 @@ public class PlatformUtils {
* @param readClo Reader closure.
* @return Map.
*/
- public static Map readMap(PortableRawReaderEx reader,
+ public static Map readMap(BinaryRawReaderEx reader,
@Nullable PlatformReaderBiClosure readClo) {
int cnt = reader.readInt();
@@ -377,7 +377,7 @@ public class PlatformUtils {
* @param reader Reader.
* @return Map.
*/
- public static Map readNullableMap(PortableRawReaderEx reader) {
+ public static Map readNullableMap(BinaryRawReaderEx reader) {
if (!reader.readBoolean())
return null;
@@ -390,7 +390,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param val Values.
*/
- public static void writeIgniteUuid(PortableRawWriterEx writer, IgniteUuid val) {
+ public static void writeIgniteUuid(BinaryRawWriterEx writer, IgniteUuid val) {
if (val == null)
writer.writeUuid(null);
else {
@@ -483,7 +483,7 @@ public class PlatformUtils {
try (PlatformMemory mem = ctx.memory().allocate()) {
PlatformOutputStream out = mem.output();
- PortableRawWriterEx writer = ctx.writer(out);
+ BinaryRawWriterEx writer = ctx.writer(out);
int cntPos = writer.reserveInt();
@@ -552,7 +552,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param evt Event.
*/
- private static void writeCacheEntryEvent(PortableRawWriterEx writer, CacheEntryEvent evt) {
+ private static void writeCacheEntryEvent(BinaryRawWriterEx writer, CacheEntryEvent evt) {
writer.writeObjectDetached(evt.getKey());
writer.writeObjectDetached(evt.getOldValue());
writer.writeObjectDetached(evt.getValue());
@@ -564,7 +564,7 @@ public class PlatformUtils {
* @param err Error.
* @param writer Writer.
*/
- public static void writeErrorData(Throwable err, PortableRawWriterEx writer) {
+ public static void writeErrorData(Throwable err, BinaryRawWriterEx writer) {
writeErrorData(err, writer, null);
}
@@ -574,7 +574,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param log Optional logger.
*/
- public static void writeErrorData(Throwable err, PortableRawWriterEx writer, @Nullable IgniteLogger log) {
+ public static void writeErrorData(Throwable err, BinaryRawWriterEx writer, @Nullable IgniteLogger log) {
// Write additional data if needed.
if (err instanceof PlatformExtendedException) {
PlatformExtendedException err0 = (PlatformExtendedException)err;
@@ -659,7 +659,7 @@ public class PlatformUtils {
// Write error data.
PlatformOutputStream out = mem.output();
- PortableRawWriterEx writer = ctx.writer(out);
+ BinaryRawWriterEx writer = ctx.writer(out);
try {
PlatformUtils.writeErrorData(err, writer, ctx.kernalContext().log(PlatformContext.class));
@@ -696,7 +696,7 @@ public class PlatformUtils {
* @param resObj Result.
* @param err Error.
*/
- public static void writeInvocationResult(PortableRawWriterEx writer, Object resObj, Exception err)
+ public static void writeInvocationResult(BinaryRawWriterEx writer, Object resObj, Exception err)
{
if (err == null) {
writer.writeBoolean(true);
@@ -732,7 +732,7 @@ public class PlatformUtils {
* @return Result.
* @throws IgniteCheckedException When invocation result is an error.
*/
- public static Object readInvocationResult(PlatformContext ctx, PortableRawReaderEx reader)
+ public static Object readInvocationResult(PlatformContext ctx, BinaryRawReaderEx reader)
throws IgniteCheckedException {
// 1. Read success flag.
boolean success = reader.readBoolean();
@@ -769,7 +769,7 @@ public class PlatformUtils {
* @param writer Writer.
* @param cfg Configuration.
*/
- public static void writeDotNetConfiguration(PortableRawWriterEx writer, PlatformDotNetConfiguration cfg) {
+ public static void writeDotNetConfiguration(BinaryRawWriterEx writer, PlatformDotNetConfiguration cfg) {
// 1. Write assemblies.
writeNullableCollection(writer, cfg.getAssemblies());
@@ -780,7 +780,7 @@ public class PlatformUtils {
writeNullableCollection(writer, portableCfg.getTypesConfiguration(),
new PlatformWriterClosure() {
- @Override public void write(PortableRawWriterEx writer, PlatformDotNetPortableTypeConfiguration typ) {
+ @Override public void write(BinaryRawWriterEx writer, PlatformDotNetPortableTypeConfiguration typ) {
writer.writeString(typ.getTypeName());
writer.writeString(typ.getNameMapper());
writer.writeString(typ.getIdMapper());
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterBiClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterBiClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterBiClosure.java
index 6b04ad3..b0e6a65 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterBiClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterBiClosure.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.platform.utils;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.portable.BinaryRawWriterEx;
/**
* Interop writer bi-closure.
@@ -30,5 +30,5 @@ public interface PlatformWriterBiClosure {
* @param val1 Value 1.
* @param val2 Value 2.
*/
- public void write(PortableRawWriterEx writer, T1 val1, T2 val2);
+ public void write(BinaryRawWriterEx writer, T1 val1, T2 val2);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterClosure.java
index a67d70a..c55c209 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterClosure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformWriterClosure.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.platform.utils;
-import org.apache.ignite.internal.portable.PortableRawWriterEx;
+import org.apache.ignite.internal.portable.BinaryRawWriterEx;
/**
* Interop writer closure.
@@ -29,5 +29,5 @@ public interface PlatformWriterClosure {
* @param writer Writer.
* @param val Value.
*/
- public void write(PortableRawWriterEx writer, T val);
+ public void write(BinaryRawWriterEx writer, T val);
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index cf8d4a2..7697a12 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -155,22 +155,6 @@ public interface GridQueryIndexing {
public void unregisterCache(CacheConfiguration, ?> ccfg) throws IgniteCheckedException;
/**
- * Checks if the given class can be mapped to a simple SQL type.
- *
- * @param cls Class.
- * @return {@code true} If can.
- */
- public boolean isSqlType(Class> cls);
-
- /**
- * Checks if the given class is GEOMETRY.
- *
- * @param cls Class.
- * @return {@code true} If this is geometry.
- */
- public boolean isGeometryClass(Class> cls);
-
- /**
* Registers type if it was not known before or updates it otherwise.
*
* @param spaceName Space name.
@@ -257,4 +241,4 @@ public interface GridQueryIndexing {
* @param reconnectFut Reconnect future.
*/
public void onDisconnected(IgniteFuture> reconnectFut);
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 84db145..d1f9869 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -21,6 +21,9 @@ import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field;
import java.lang.reflect.Member;
import java.lang.reflect.Method;
+import java.math.BigDecimal;
+import java.sql.Time;
+import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -31,7 +34,9 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.TreeSet;
+import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import javax.cache.Cache;
@@ -40,14 +45,15 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.cache.CacheTypeMetadata;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.QueryIndexType;
import org.apache.ignite.cache.query.QueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.cache.query.SqlQuery;
-import org.apache.ignite.cache.query.annotations.QueryGroupIndex;
-import org.apache.ignite.cache.query.annotations.QuerySqlField;
-import org.apache.ignite.cache.query.annotations.QueryTextField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.events.CacheQueryExecutedEvent;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
@@ -89,6 +95,31 @@ import static org.apache.ignite.internal.processors.query.GridQueryIndexType.SOR
* Indexing processor.
*/
public class GridQueryProcessor extends GridProcessorAdapter {
+ /** */
+ public static final String _VAL = "_val";
+
+ /** */
+ private static final Class> GEOMETRY_CLASS = U.classForName("com.vividsolutions.jts.geom.Geometry", null);
+
+ /** */
+ private static Set> SQL_TYPES = new HashSet<>(F.>asList(
+ Integer.class,
+ Boolean.class,
+ Byte.class,
+ Short.class,
+ Long.class,
+ BigDecimal.class,
+ Double.class,
+ Float.class,
+ Time.class,
+ Timestamp.class,
+ java.util.Date.class,
+ java.sql.Date.class,
+ String.class,
+ UUID.class,
+ byte[].class
+ ));
+
/** For tests. */
public static Class extends GridQueryIndexing> idxCls;
@@ -140,7 +171,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @return {@code true} If query index must be enabled for this cache.
*/
public static boolean isEnabled(CacheConfiguration,?> ccfg) {
- return !F.isEmpty(ccfg.getIndexedTypes()) || !F.isEmpty(ccfg.getTypeMetadata());
+ return !F.isEmpty(ccfg.getIndexedTypes()) ||
+ !F.isEmpty(ccfg.getTypeMetadata()) ||
+ !F.isEmpty(ccfg.getQueryEntities());
}
/**
@@ -158,58 +191,128 @@ public class GridQueryProcessor extends GridProcessorAdapter {
idx.registerCache(ccfg);
try {
- if (!F.isEmpty(ccfg.getTypeMetadata())) {
- for (CacheTypeMetadata meta : ccfg.getTypeMetadata()) {
- if (F.isEmpty(meta.getValueType()))
- throw new IgniteCheckedException("Value type is not set: " + meta);
+ if (!F.isEmpty(ccfg.getQueryEntities())) {
+ for (QueryEntity qryEntity : ccfg.getQueryEntities()) {
+ if (F.isEmpty(qryEntity.getValueType()))
+ throw new IgniteCheckedException("Value type is not set: " + qryEntity);
TypeDescriptor desc = new TypeDescriptor();
- Class> valCls = U.classForName(meta.getValueType(), null);
+ // Key and value classes still can be available if they are primitive or JDK part.
+ // We need that to set correct types for _key and _val columns.
+ Class> keyCls = U.classForName(qryEntity.getKeyType(), Object.class);
+ Class> valCls = U.classForName(qryEntity.getValueType(), null);
+
+ String simpleValType = valCls == null ? qryEntity.getValueType() : typeName(valCls);
- desc.name(valCls != null ? typeName(valCls) : meta.getValueType());
+ desc.name(simpleValType);
- desc.valueClass(valCls != null ? valCls : Object.class);
- desc.keyClass(
- meta.getKeyType() == null ?
- Object.class :
- U.classForName(meta.getKeyType(), Object.class));
+ if (ctx.cacheObjects().isPortableEnabled(ccfg)) {
+ // Safe to check null.
+ if (SQL_TYPES.contains(valCls))
+ desc.valueClass(valCls);
+ else
+ desc.valueClass(Object.class);
+
+ if (SQL_TYPES.contains(keyCls))
+ desc.keyClass(keyCls);
+ else
+ desc.keyClass(Object.class);
+ }
+ else {
+ desc.valueClass(valCls);
+ desc.keyClass(keyCls);
+ }
TypeId typeId;
+ TypeId altTypeId = null;
if (valCls == null || ctx.cacheObjects().isPortableEnabled(ccfg)) {
- processPortableMeta(meta, desc);
+ processPortableMeta(qryEntity, desc);
- typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(meta.getValueType()));
+ typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(qryEntity.getValueType()));
+
+ if (valCls != null)
+ altTypeId = new TypeId(ccfg.getName(), valCls);
}
else {
- processClassMeta(meta, desc);
+ processClassMeta(qryEntity, desc);
typeId = new TypeId(ccfg.getName(), valCls);
+ altTypeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(qryEntity.getValueType()));
}
addTypeByName(ccfg, desc);
types.put(typeId, desc);
+ if (altTypeId != null)
+ types.put(altTypeId, desc);
+
desc.registered(idx.registerType(ccfg.getName(), desc));
+
}
}
- Class>[] clss = ccfg.getIndexedTypes();
+ if (!F.isEmpty(ccfg.getTypeMetadata())) {
+ for (CacheTypeMetadata meta : ccfg.getTypeMetadata()) {
+ if (F.isEmpty(meta.getValueType()))
+ throw new IgniteCheckedException("Value type is not set: " + meta);
+
+ TypeDescriptor desc = new TypeDescriptor();
+
+ // Key and value classes still can be available if they are primitive or JDK part.
+ // We need that to set correct types for _key and _val columns.
+ Class> keyCls = U.classForName(meta.getKeyType(), Object.class);
+ Class> valCls = U.classForName(meta.getValueType(), null);
+
+ desc.name(meta.getSimpleValueType());
- if (!F.isEmpty(clss)) {
- for (int i = 0; i < clss.length; i += 2) {
- Class> keyCls = clss[i];
- Class> valCls = clss[i + 1];
+ if (ctx.cacheObjects().isPortableEnabled(ccfg)) {
+ // Safe to check null.
+ if (SQL_TYPES.contains(valCls))
+ desc.valueClass(valCls);
+ else
+ desc.valueClass(Object.class);
- TypeDescriptor desc = processKeyAndValueClasses(keyCls, valCls);
+ if (SQL_TYPES.contains(keyCls))
+ desc.keyClass(keyCls);
+ else
+ desc.keyClass(Object.class);
+ }
+ else {
+ desc.valueClass(valCls);
+ desc.keyClass(keyCls);
+ }
+
+ TypeId typeId;
+ TypeId altTypeId = null;
+
+ if (valCls == null || ctx.cacheObjects().isPortableEnabled(ccfg)) {
+ processPortableMeta(meta, desc);
+
+ typeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(meta.getValueType()));
+
+ if (valCls != null)
+ altTypeId = new TypeId(ccfg.getName(), valCls);
+ }
+ else {
+ processClassMeta(meta, desc);
+
+ typeId = new TypeId(ccfg.getName(), valCls);
+ altTypeId = new TypeId(ccfg.getName(), ctx.cacheObjects().typeId(meta.getValueType()));
+ }
addTypeByName(ccfg, desc);
- types.put(new TypeId(ccfg.getName(), valCls), desc);
+ types.put(typeId, desc);
+
+ if (altTypeId != null)
+ types.put(altTypeId, desc);
desc.registered(idx.registerType(ccfg.getName(), desc));
}
}
+
+ // Indexed types must be translated to CacheTypeMetadata in CacheConfiguration.
}
catch (IgniteCheckedException | RuntimeException e) {
idx.unregisterCache(ccfg);
@@ -229,33 +332,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
"in cache '" + ccfg.getName() + "'.");
}
- /**
- * @param keyCls Key class.
- * @param valCls Value class.
- * @return Type descriptor.
- * @throws IgniteCheckedException If failed.
- */
- private TypeDescriptor processKeyAndValueClasses(
- Class> keyCls,
- Class> valCls
- )
- throws IgniteCheckedException {
- TypeDescriptor d = new TypeDescriptor();
-
- d.keyClass(keyCls);
- d.valueClass(valCls);
-
- processAnnotationsInClass(true, d.keyCls, d, null);
-
- String valTypeName = typeName(valCls);
-
- d.name(valTypeName);
-
- processAnnotationsInClass(false, d.valCls, d, null);
-
- return d;
- }
-
/** {@inheritDoc} */
@Override public void onKernalStop(boolean cancel) {
super.onKernalStop(cancel);
@@ -845,6 +921,28 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
+ * Checks if the given class can be mapped to a simple SQL type.
+ *
+ * @param cls Class.
+ * @return {@code true} If can.
+ */
+ public static boolean isSqlType(Class> cls) {
+ cls = U.box(cls);
+
+ return SQL_TYPES.contains(cls) || isGeometryClass(cls);
+ }
+
+ /**
+ * Checks if the given class is GEOMETRY.
+ *
+ * @param cls Class.
+ * @return {@code true} If this is geometry.
+ */
+ public static boolean isGeometryClass(Class> cls) {
+ return GEOMETRY_CLASS != null && GEOMETRY_CLASS.isAssignableFrom(cls);
+ }
+
+ /**
* Gets type name by class.
*
* @param cls Class.
@@ -1050,182 +1148,168 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
/**
- * Process annotations for class.
+ * Processes declarative metadata for class.
*
- * @param key If given class relates to key.
- * @param cls Class.
- * @param type Type descriptor.
- * @param parent Parent in case of embeddable.
- * @throws IgniteCheckedException In case of error.
+ * @param meta Type metadata.
+ * @param d Type descriptor.
+ * @throws IgniteCheckedException If failed.
*/
- private void processAnnotationsInClass(boolean key, Class> cls, TypeDescriptor type,
- @Nullable ClassProperty parent) throws IgniteCheckedException {
- if (U.isJdk(cls) || idx.isGeometryClass(cls)) {
- if (parent == null && !key && idx.isSqlType(cls) ) { // We have to index primitive _val.
- String idxName = "_val_idx";
-
- type.addIndex(idxName, idx.isGeometryClass(cls) ? GEO_SPATIAL : SORTED);
+ private void processClassMeta(CacheTypeMetadata meta, TypeDescriptor d)
+ throws IgniteCheckedException {
+ Map aliases = meta.getAliases();
- type.addFieldToIndex(idxName, "_VAL", 0, false);
- }
+ if (aliases == null)
+ aliases = Collections.emptyMap();
- return;
- }
+ Class> keyCls = d.keyClass();
+ Class> valCls = d.valueClass();
- if (parent != null && parent.knowsClass(cls))
- throw new IgniteCheckedException("Recursive reference found in type: " + cls.getName());
+ assert keyCls != null;
+ assert valCls != null;
- if (parent == null) { // Check class annotation at top level only.
- QueryTextField txtAnnCls = cls.getAnnotation(QueryTextField.class);
+ for (Map.Entry> entry : meta.getAscendingFields().entrySet())
+ addToIndex(d, keyCls, valCls, entry.getKey(), entry.getValue(), 0, IndexType.ASC, null, aliases);
- if (txtAnnCls != null)
- type.valueTextIndex(true);
+ for (Map.Entry> entry : meta.getDescendingFields().entrySet())
+ addToIndex(d, keyCls, valCls, entry.getKey(), entry.getValue(), 0, IndexType.DESC, null, aliases);
- QueryGroupIndex grpIdx = cls.getAnnotation(QueryGroupIndex.class);
+ for (String txtField : meta.getTextFields())
+ addToIndex(d, keyCls, valCls, txtField, String.class, 0, IndexType.TEXT, null, aliases);
- if (grpIdx != null)
- type.addIndex(grpIdx.name(), SORTED);
+ Map, Boolean>>> grps = meta.getGroups();
- QueryGroupIndex.List grpIdxList = cls.getAnnotation(QueryGroupIndex.List.class);
+ if (grps != null) {
+ for (Map.Entry, Boolean>>> entry : grps.entrySet()) {
+ String idxName = entry.getKey();
- if (grpIdxList != null && !F.isEmpty(grpIdxList.value())) {
- for (QueryGroupIndex idx : grpIdxList.value())
- type.addIndex(idx.name(), SORTED);
- }
- }
+ LinkedHashMap, Boolean>> idxFields = entry.getValue();
- for (Class> c = cls; c != null && !c.equals(Object.class); c = c.getSuperclass()) {
- for (Field field : c.getDeclaredFields()) {
- QuerySqlField sqlAnn = field.getAnnotation(QuerySqlField.class);
- QueryTextField txtAnn = field.getAnnotation(QueryTextField.class);
+ int order = 0;
- if (sqlAnn != null || txtAnn != null) {
- ClassProperty prop = new ClassProperty(field, key);
+ for (Map.Entry, Boolean>> idxField : idxFields.entrySet()) {
+ Boolean descending = idxField.getValue().get2();
- prop.parent(parent);
+ if (descending == null)
+ descending = false;
- processAnnotation(key, sqlAnn, txtAnn, field.getType(), prop, type);
+ addToIndex(d, keyCls, valCls, idxField.getKey(), idxField.getValue().get1(), order,
+ descending ? IndexType.DESC : IndexType.ASC, idxName, aliases);
- type.addProperty(prop, true);
+ order++;
}
}
+ }
- for (Method mtd : c.getDeclaredMethods()) {
- QuerySqlField sqlAnn = mtd.getAnnotation(QuerySqlField.class);
- QueryTextField txtAnn = mtd.getAnnotation(QueryTextField.class);
-
- if (sqlAnn != null || txtAnn != null) {
- if (mtd.getParameterTypes().length != 0)
- throw new IgniteCheckedException("Getter with QuerySqlField " +
- "annotation cannot have parameters: " + mtd);
-
- ClassProperty prop = new ClassProperty(mtd, key);
-
- prop.parent(parent);
-
- processAnnotation(key, sqlAnn, txtAnn, mtd.getReturnType(), prop, type);
+ for (Map.Entry> entry : meta.getQueryFields().entrySet()) {
+ ClassProperty prop = buildClassProperty(
+ keyCls,
+ valCls,
+ entry.getKey(),
+ entry.getValue(),
+ aliases);
- type.addProperty(prop, true);
- }
- }
+ d.addProperty(prop, false);
}
}
/**
- * Processes annotation at field or method.
- *
- * @param key If given class relates to key.
- * @param sqlAnn SQL annotation, can be {@code null}.
- * @param txtAnn H2 text annotation, can be {@code null}.
- * @param cls Class of field or return type for method.
- * @param prop Current property.
- * @param desc Class description.
- * @throws IgniteCheckedException In case of error.
+ * @param d Type descriptor.
+ * @param keyCls Key class.
+ * @param valCls Value class.
+ * @param pathStr Path string.
+ * @param resType Result type.
+ * @param idxOrder Order number in index or {@code -1} if no need to index.
+ * @param idxType Index type.
+ * @param idxName Index name.
+ * @param aliases Aliases.
+ * @throws IgniteCheckedException If failed.
*/
- private void processAnnotation(boolean key, QuerySqlField sqlAnn, QueryTextField txtAnn,
- Class> cls, ClassProperty prop, TypeDescriptor desc) throws IgniteCheckedException {
- if (sqlAnn != null) {
- processAnnotationsInClass(key, cls, desc, prop);
-
- if (!sqlAnn.name().isEmpty())
- prop.name(sqlAnn.name());
+ private void addToIndex(
+ TypeDescriptor d,
+ Class> keyCls,
+ Class> valCls,
+ String pathStr,
+ Class> resType,
+ int idxOrder,
+ IndexType idxType,
+ String idxName,
+ Map aliases
+ ) throws IgniteCheckedException {
+ String propName;
+ Class> propCls;
+
+ if (_VAL.equals(pathStr)) {
+ propName = _VAL;
+ propCls = valCls;
+ }
+ else {
+ ClassProperty prop = buildClassProperty(
+ keyCls,
+ valCls,
+ pathStr,
+ resType,
+ aliases);
- if (sqlAnn.index()) {
- String idxName = prop.name() + "_idx";
+ d.addProperty(prop, false);
- desc.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ propName = prop.name();
+ propCls = prop.type();
+ }
- desc.addFieldToIndex(idxName, prop.name(), 0, sqlAnn.descending());
- }
+ if (idxType != null) {
+ if (idxName == null)
+ idxName = propName + "_idx";
- if (!F.isEmpty(sqlAnn.groups())) {
- for (String group : sqlAnn.groups())
- desc.addFieldToIndex(group, prop.name(), 0, false);
- }
+ if (idxOrder == 0) // Add index only on the first field.
+ d.addIndex(idxName, isGeometryClass(propCls) ? GEO_SPATIAL : SORTED);
- if (!F.isEmpty(sqlAnn.orderedGroups())) {
- for (QuerySqlField.Group idx : sqlAnn.orderedGroups())
- desc.addFieldToIndex(idx.name(), prop.name(), idx.order(), idx.descending());
- }
+ if (idxType == IndexType.TEXT)
+ d.addFieldToTextIndex(propName);
+ else
+ d.addFieldToIndex(idxName, propName, idxOrder, idxType == IndexType.DESC);
}
-
- if (txtAnn != null)
- desc.addFieldToTextIndex(prop.name());
}
/**
- * Processes declarative metadata for class.
+ * Processes declarative metadata for portable object.
*
- * @param meta Type metadata.
+ * @param meta Declared metadata.
* @param d Type descriptor.
* @throws IgniteCheckedException If failed.
*/
- private void processClassMeta(CacheTypeMetadata meta, TypeDescriptor d)
+ private void processPortableMeta(CacheTypeMetadata meta, TypeDescriptor d)
throws IgniteCheckedException {
- Class> keyCls = d.keyClass();
- Class> valCls = d.valueClass();
+ Map aliases = meta.getAliases();
- assert keyCls != null;
- assert valCls != null;
+ if (aliases == null)
+ aliases = Collections.emptyMap();
for (Map.Entry> entry : meta.getAscendingFields().entrySet()) {
- ClassProperty prop = buildClassProperty(
- keyCls,
- valCls,
- entry.getKey(),
- entry.getValue());
+ PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases);
d.addProperty(prop, false);
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, false);
}
for (Map.Entry> entry : meta.getDescendingFields().entrySet()) {
- ClassProperty prop = buildClassProperty(
- keyCls,
- valCls,
- entry.getKey(),
- entry.getValue());
+ PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases);
d.addProperty(prop, false);
String idxName = prop.name() + "_idx";
- d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ d.addIndex(idxName, isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
d.addFieldToIndex(idxName, prop.name(), 0, true);
}
for (String txtIdx : meta.getTextFields()) {
- ClassProperty prop = buildClassProperty(
- keyCls,
- valCls,
- txtIdx,
- String.class);
+ PortableProperty prop = buildPortableProperty(txtIdx, String.class, aliases);
d.addProperty(prop, false);
@@ -1243,11 +1327,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
int order = 0;
for (Map.Entry, Boolean>> idxField : idxFields.entrySet()) {
- ClassProperty prop = buildClassProperty(
- keyCls,
- valCls,
- idxField.getKey(),
- idxField.getValue().get1());
+ PortableProperty prop = buildPortableProperty(idxField.getKey(), idxField.getValue().get1(), aliases);
d.addProperty(prop, false);
@@ -1261,86 +1341,113 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
for (Map.Entry> entry : meta.getQueryFields().entrySet()) {
- ClassProperty prop = buildClassProperty(
- keyCls,
- valCls,
- entry.getKey(),
- entry.getValue());
+ PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue(), aliases);
- d.addProperty(prop, false);
+ if (!d.props.containsKey(prop.name()))
+ d.addProperty(prop, false);
}
}
/**
* Processes declarative metadata for portable object.
*
- * @param meta Declared metadata.
+ * @param qryEntity Declared metadata.
* @param d Type descriptor.
* @throws IgniteCheckedException If failed.
*/
- private void processPortableMeta(CacheTypeMetadata meta, TypeDescriptor d)
- throws IgniteCheckedException {
- for (Map.Entry> entry : meta.getAscendingFields().entrySet()) {
- PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue());
-
- d.addProperty(prop, false);
+ private void processPortableMeta(QueryEntity qryEntity, TypeDescriptor d) throws IgniteCheckedException {
+ Map aliases = qryEntity.getAliases();
- String idxName = prop.name() + "_idx";
+ if (aliases == null)
+ aliases = Collections.emptyMap();
- d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ for (Map.Entry entry : qryEntity.getFields().entrySet()) {
+ PortableProperty prop = buildPortableProperty(entry.getKey(), U.classForName(entry.getValue(), Object.class), aliases);
- d.addFieldToIndex(idxName, prop.name(), 0, false);
+ d.addProperty(prop, false);
}
- for (Map.Entry> entry : meta.getDescendingFields().entrySet()) {
- PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue());
-
- d.addProperty(prop, false);
+ processIndexes(qryEntity, d);
+ }
- String idxName = prop.name() + "_idx";
+ /**
+ * Processes declarative metadata for portable object.
+ *
+ * @param qryEntity Declared metadata.
+ * @param d Type descriptor.
+ * @throws IgniteCheckedException If failed.
+ */
+ private void processClassMeta(QueryEntity qryEntity, TypeDescriptor d) throws IgniteCheckedException {
+ Map aliases = qryEntity.getAliases();
- d.addIndex(idxName, idx.isGeometryClass(prop.type()) ? GEO_SPATIAL : SORTED);
+ if (aliases == null)
+ aliases = Collections.emptyMap();
- d.addFieldToIndex(idxName, prop.name(), 0, true);
- }
+ for (Map.Entry entry : qryEntity.getFields().entrySet()) {
+ ClassProperty prop = buildClassProperty(
+ d.keyClass(),
+ d.valueClass(),
+ entry.getKey(),
+ U.classForName(entry.getValue(), Object.class),
+ aliases);
- for (String txtIdx : meta.getTextFields()) {
- PortableProperty prop = buildPortableProperty(txtIdx, String.class);
d.addProperty(prop, false);
-
- d.addFieldToTextIndex(prop.name());
}
- Map, Boolean>>> grps = meta.getGroups();
+ processIndexes(qryEntity, d);
+ }
- if (grps != null) {
- for (Map.Entry, Boolean>>> entry : grps.entrySet()) {
- String idxName = entry.getKey();
+ /**
+ * Processes indexes based on query entity.
+ *
+ * @param qryEntity Query entity to process.
+ * @param d Type descriptor to populate.
+ * @throws IgniteCheckedException If failed to build index information.
+ */
+ private void processIndexes(QueryEntity qryEntity, TypeDescriptor d) throws IgniteCheckedException {
+ if (!F.isEmpty(qryEntity.getIndexes())) {
+ Map aliases = qryEntity.getAliases();
- LinkedHashMap, Boolean>> idxFields = entry.getValue();
+ if (aliases == null)
+ aliases = Collections.emptyMap();
- int order = 0;
+ for (QueryIndex idx : qryEntity.getIndexes()) {
+ String idxName = idx.getName();
- for (Map.Entry, Boolean>> idxField : idxFields.entrySet()) {
- PortableProperty prop = buildPortableProperty(idxField.getKey(), idxField.getValue().get1());
+ if (idxName == null)
+ idxName = QueryEntity.defaultIndexName(idx);
- d.addProperty(prop, false);
+ if (idx.getIndexType() == QueryIndexType.SORTED || idx.getIndexType() == QueryIndexType.GEOSPATIAL) {
+ d.addIndex(idxName, idx.getIndexType() == QueryIndexType.SORTED ? SORTED : GEO_SPATIAL);
- Boolean descending = idxField.getValue().get2();
+ int i = 0;
- d.addFieldToIndex(idxName, prop.name(), order, descending != null && descending);
+ for (Map.Entry entry : idx.getFields().entrySet()) {
+ String field = entry.getKey();
+ boolean asc = entry.getValue();
- order++;
+ String alias = aliases.get(field);
+
+ if (alias != null)
+ field = alias;
+
+ d.addFieldToIndex(idxName, field, i++, !asc);
+ }
}
- }
- }
+ else {
+ assert idx.getIndexType() == QueryIndexType.FULLTEXT;
- for (Map.Entry> entry : meta.getQueryFields().entrySet()) {
- PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue());
+ for (String field : idx.getFields().keySet()) {
+ String alias = aliases.get(field);
- if (!d.props.containsKey(prop.name()))
- d.addProperty(prop, false);
+ if (alias != null)
+ field = alias;
+
+ d.addFieldToTextIndex(field);
+ }
+ }
+ }
}
}
@@ -1350,15 +1457,26 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param pathStr String representing path to the property. May contains dots '.' to identify
* nested fields.
* @param resType Result type.
+ * @param aliases Aliases.
* @return Portable property.
*/
- private PortableProperty buildPortableProperty(String pathStr, Class> resType) {
+ private PortableProperty buildPortableProperty(String pathStr, Class> resType, Map aliases) {
String[] path = pathStr.split("\\.");
PortableProperty res = null;
- for (String prop : path)
- res = new PortableProperty(prop, res, resType);
+ StringBuilder fullName = new StringBuilder();
+
+ for (String prop : path) {
+ if (fullName.length() != 0)
+ fullName.append('.');
+
+ fullName.append(prop);
+
+ String alias = aliases.get(fullName.toString());
+
+ res = new PortableProperty(prop, res, resType, alias);
+ }
return res;
}
@@ -1368,19 +1486,21 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param valCls Value class.
* @param pathStr Path string.
* @param resType Result type.
+ * @param aliases Aliases.
* @return Class property.
* @throws IgniteCheckedException If failed.
*/
- private static ClassProperty buildClassProperty(Class> keyCls, Class> valCls, String pathStr, Class> resType)
- throws IgniteCheckedException {
+ private static ClassProperty buildClassProperty(Class> keyCls, Class> valCls, String pathStr, Class> resType,
+ Map aliases) throws IgniteCheckedException {
ClassProperty res = buildClassProperty(
true,
keyCls,
pathStr,
- resType);
+ resType,
+ aliases);
if (res == null) // We check key before value consistently with PortableProperty.
- res = buildClassProperty(false, valCls, pathStr, resType);
+ res = buildClassProperty(false, valCls, pathStr, resType, aliases);
if (res == null)
throw new IgniteCheckedException("Failed to initialize property '" + pathStr + "' for " +
@@ -1395,16 +1515,25 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param cls Source type class.
* @param pathStr String representing path to the property. May contains dots '.' to identify nested fields.
* @param resType Expected result type.
+ * @param aliases Aliases.
* @return Property instance corresponding to the given path.
- * @throws IgniteCheckedException If property cannot be created.
*/
- static ClassProperty buildClassProperty(boolean key, Class> cls, String pathStr, Class> resType)
- throws IgniteCheckedException {
+ static ClassProperty buildClassProperty(boolean key, Class> cls, String pathStr, Class> resType,
+ Map aliases) {
String[] path = pathStr.split("\\.");
ClassProperty res = null;
+ StringBuilder fullName = new StringBuilder();
+
for (String prop : path) {
+ if (fullName.length() != 0)
+ fullName.append('.');
+
+ fullName.append(prop);
+
+ String alias = aliases.get(fullName.toString());
+
ClassProperty tmp;
try {
@@ -1414,11 +1543,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
bld.setCharAt(3, Character.toUpperCase(bld.charAt(3)));
- tmp = new ClassProperty(cls.getMethod(bld.toString()), key);
+ tmp = new ClassProperty(cls.getMethod(bld.toString()), key, alias);
}
catch (NoSuchMethodException ignore) {
try {
- tmp = new ClassProperty(cls.getDeclaredField(prop), key);
+ tmp = new ClassProperty(cls.getDeclaredField(prop), key, alias);
}
catch (NoSuchFieldException ignored) {
return null;
@@ -1585,11 +1714,12 @@ public class GridQueryProcessor extends GridProcessorAdapter {
*
* @param member Element.
*/
- ClassProperty(Member member, boolean key) {
+ ClassProperty(Member member, boolean key, String name) {
this.member = member;
this.key = key;
- name = member instanceof Method && member.getName().startsWith("get") && member.getName().length() > 3 ?
+ this.name = !F.isEmpty(name) ? name :
+ member instanceof Method && member.getName().startsWith("get") && member.getName().length() > 3 ?
member.getName().substring(3) : member.getName();
((AccessibleObject) member).setAccessible(true);
@@ -1624,13 +1754,6 @@ public class GridQueryProcessor extends GridProcessorAdapter {
}
}
- /**
- * @param name Property name.
- */
- public void name(String name) {
- this.name = name;
- }
-
/** {@inheritDoc} */
@Override public String name() {
return name;
@@ -1669,6 +1792,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** Property name. */
private String propName;
+ /** */
+ private String alias;
+
/** Parent property. */
private PortableProperty parent;
@@ -1685,8 +1811,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
* @param parent Parent property.
* @param type Result type.
*/
- private PortableProperty(String propName, PortableProperty parent, Class> type) {
+ private PortableProperty(String propName, PortableProperty parent, Class> type, String alias) {
this.propName = propName;
+ this.alias = F.isEmpty(alias) ? propName : alias;
this.parent = parent;
this.type = type;
}
@@ -1711,9 +1838,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
if (isKeyProp0 == 0) {
// Key is allowed to be a non-portable object here.
// We check key before value consistently with ClassProperty.
- if (ctx.cacheObjects().isPortableObject(key) && ctx.cacheObjects().hasField(key, propName))
+ if (key instanceof BinaryObject && ((BinaryObject)key).hasField(propName))
isKeyProp = isKeyProp0 = 1;
- else if (ctx.cacheObjects().hasField(val, propName))
+ else if (val instanceof BinaryObject && ((BinaryObject)val).hasField(propName))
isKeyProp = isKeyProp0 = -1;
else {
U.warn(log, "Neither key nor value have property " +
@@ -1731,7 +1858,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@Override public String name() {
- return propName;
+ return alias;
}
/** {@inheritDoc} */
@@ -2126,4 +2253,11 @@ public class GridQueryProcessor extends GridProcessorAdapter {
return S.toString(TypeName.class, this);
}
}
+
+ /**
+ * The way to index.
+ */
+ private enum IndexType {
+ ASC, DESC, TEXT
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientTaskRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientTaskRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientTaskRequest.java
index 6b53143..3ac16f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientTaskRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/client/message/GridClientTaskRequest.java
@@ -35,7 +35,7 @@ public class GridClientTaskRequest extends GridClientAbstractMessage {
/** Task parameter. */
private Object arg;
- /** Keep portables flag. */
+ /** Keep binary flag. */
private boolean keepPortables;
/**
@@ -67,14 +67,14 @@ public class GridClientTaskRequest extends GridClientAbstractMessage {
}
/**
- * @return Keep portables flag.
+ * @return Keep binary flag.
*/
public boolean keepPortables() {
return keepPortables;
}
/**
- * @param keepPortables Keep portables flag.
+ * @param keepPortables Keep binary flag.
*/
public void keepPortables(boolean keepPortables) {
this.keepPortables = keepPortables;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index 3c1913a..259d8c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -1336,9 +1336,9 @@ public abstract class IgniteUtils {
*/
@Nullable public static Class> classForName(String cls, @Nullable Class> dflt) {
try {
- return Class.forName(cls);
+ return cls == null ? dflt : Class.forName(cls);
}
- catch (ClassNotFoundException e) {
+ catch (ClassNotFoundException ignore) {
return dflt;
}
}
@@ -8098,9 +8098,10 @@ public abstract class IgniteUtils {
if (cls == null)
return null;
- Class> boxed = boxedClsMap.get(cls);
+ if (!cls.isPrimitive())
+ return cls;
- return boxed != null ? boxed : cls;
+ return boxedClsMap.get(cls);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
index f9cf509..d3e7437 100644
--- a/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
+++ b/modules/core/src/main/java/org/apache/ignite/marshaller/portable/PortableMarshaller.java
@@ -28,11 +28,10 @@ import org.apache.ignite.internal.portable.GridPortableMarshaller;
import org.apache.ignite.internal.portable.PortableContext;
import org.apache.ignite.marshaller.AbstractMarshaller;
import org.apache.ignite.marshaller.MarshallerContext;
-import org.apache.ignite.portable.PortableException;
-import org.apache.ignite.portable.PortableIdMapper;
-import org.apache.ignite.portable.PortableObject;
-import org.apache.ignite.portable.PortableSerializer;
-import org.apache.ignite.portable.PortableTypeConfiguration;
+import org.apache.ignite.binary.BinaryTypeConfiguration;
+import org.apache.ignite.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryTypeIdMapper;
+import org.apache.ignite.binary.BinarySerializer;
import org.jetbrains.annotations.Nullable;
/**
@@ -75,17 +74,18 @@ import org.jetbrains.annotations.Nullable;
* For information about Spring framework visit www.springframework.org
*/
public class PortableMarshaller extends AbstractMarshaller {
+ // TODO ignite-1282 Move to IgniteConfiguration.
/** Class names. */
private Collection clsNames;
/** ID mapper. */
- private PortableIdMapper idMapper;
+ private BinaryTypeIdMapper idMapper;
/** Serializer. */
- private PortableSerializer serializer;
+ private BinarySerializer serializer;
/** Types. */
- private Collection typeCfgs;
+ private Collection typeCfgs;
/** Whether to convert string to bytes using UTF-8 encoding. */
private boolean convertString = true;
@@ -125,7 +125,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @return ID mapper.
*/
- public PortableIdMapper getIdMapper() {
+ public BinaryTypeIdMapper getIdMapper() {
return idMapper;
}
@@ -134,7 +134,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @param idMapper ID mapper.
*/
- public void setIdMapper(PortableIdMapper idMapper) {
+ public void setIdMapper(BinaryTypeIdMapper idMapper) {
this.idMapper = idMapper;
}
@@ -143,7 +143,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @return Serializer.
*/
- public PortableSerializer getSerializer() {
+ public BinarySerializer getSerializer() {
return serializer;
}
@@ -152,7 +152,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @param serializer Serializer.
*/
- public void setSerializer(PortableSerializer serializer) {
+ public void setSerializer(BinarySerializer serializer) {
this.serializer = serializer;
}
@@ -161,7 +161,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @return Types configuration.
*/
- public Collection getTypeConfigurations() {
+ public Collection getTypeConfigurations() {
return typeCfgs;
}
@@ -170,7 +170,7 @@ public class PortableMarshaller extends AbstractMarshaller {
*
* @param typeCfgs Type configurations.
*/
- public void setTypeConfigurations(Collection typeCfgs) {
+ public void setTypeConfigurations(Collection typeCfgs) {
this.typeCfgs = typeCfgs;
}
@@ -198,7 +198,7 @@ public class PortableMarshaller extends AbstractMarshaller {
/**
* If {@code true}, meta data will be collected or all types. If you need to override this behaviour for
- * some specific type, use {@link PortableTypeConfiguration#setMetaDataEnabled(Boolean)} method.
+ * some specific type, use {@link org.apache.ignite.binary.BinaryTypeConfiguration#setMetaDataEnabled(Boolean)} method.
*
* Default value if {@code true}.
*
@@ -216,11 +216,11 @@ public class PortableMarshaller extends AbstractMarshaller {
}
/**
- * If {@code true}, {@link PortableObject} will cache deserialized instance after
- * {@link PortableObject#deserialize()} is called. All consequent calls of this
- * method on the same instance of {@link PortableObject} will return that cached
+ * If {@code true}, {@link org.apache.ignite.binary.BinaryObject} will cache deserialized instance after
+ * {@link org.apache.ignite.binary.BinaryObject#deserialize()} is called. All consequent calls of this
+ * method on the same instance of {@link org.apache.ignite.binary.BinaryObject} will return that cached
* value without actually deserializing portable object. If you need to override this
- * behaviour for some specific type, use {@link PortableTypeConfiguration#setKeepDeserialized(Boolean)}
+ * behaviour for some specific type, use {@link org.apache.ignite.binary.BinaryTypeConfiguration#setKeepDeserialized(Boolean)}
* method.
*
* Default value if {@code true}.
@@ -271,7 +271,7 @@ public class PortableMarshaller extends AbstractMarshaller {
out.write(arr);
}
catch (IOException e) {
- throw new PortableException("Failed to marshal the object: " + obj, e);
+ throw new BinaryObjectException("Failed to marshal the object: " + obj, e);
}
}
@@ -298,7 +298,7 @@ public class PortableMarshaller extends AbstractMarshaller {
return impl.deserialize(buf.toByteArray(), clsLdr);
}
catch (IOException e) {
- throw new PortableException("Failed to unmarshal the object from InputStream", e);
+ throw new BinaryObjectException("Failed to unmarshal the object from InputStream", e);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
deleted file mode 100644
index 377fcdc..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableBuilder.java
+++ /dev/null
@@ -1,137 +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.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable object builder. Provides ability to build portable objects dynamically without having class definitions.
- *
- * Here is an example of how a portable object can be built dynamically:
- *
- * PortableBuilder builder = Ignition.ignite().portables().builder("org.project.MyObject");
- *
- * builder.setField("fieldA", "A");
- * builder.setField("fieldB", "B");
- *
- * PortableObject portableObj = builder.build();
- *
- *
- *
- * Also builder can be initialized by existing portable object. This allows changing some fields without affecting
- * other fields.
- *
- * PortableBuilder builder = Ignition.ignite().portables().builder(person);
- *
- * builder.setField("name", "John");
- *
- * person = builder.build();
- *
- *
- *
- * If you need to modify nested portable object you can get builder for nested object using
- * {@link #getField(String)}, changes made on nested builder will affect parent object,
- * for example:
- *
- *
- * PortableBuilder personBuilder = grid.portables().createBuilder(personPortableObj);
- * PortableBuilder addressBuilder = personBuilder.setField("address");
- *
- * addressBuilder.setField("city", "New York");
- *
- * personPortableObj = personBuilder.build();
- *
- * // Should be "New York".
- * String city = personPortableObj.getField("address").getField("city");
- *
- *
- * @see IgnitePortables#builder(int)
- * @see IgnitePortables#builder(String)
- * @see IgnitePortables#builder(PortableObject)
- */
-public interface PortableBuilder {
- /**
- * Returns value assigned to the specified field.
- * If the value is a portable object instance of {@code GridPortableBuilder} will be returned,
- * which can be modified.
- *
- * Collections and maps returned from this method are modifiable.
- *
- * @param name Field name.
- * @return Filed value.
- */
- public T getField(String name);
-
- /**
- * Sets field value.
- *
- * @param name Field name.
- * @param val Field value (cannot be {@code null}).
- * @see PortableObject#metaData()
- */
- public PortableBuilder setField(String name, Object val);
-
- /**
- * Sets field value with value type specification.
- *
- * Field type is needed for proper metadata update.
- *
- * @param name Field name.
- * @param val Field value.
- * @param type Field type.
- * @see PortableObject#metaData()
- */
- public PortableBuilder setField(String name, @Nullable T val, Class super T> type);
-
- /**
- * Sets field value.
- *
- * This method should be used if field is portable object.
- *
- * @param name Field name.
- * @param builder Builder for object field.
- */
- public PortableBuilder setField(String name, @Nullable PortableBuilder builder);
-
- /**
- * Removes field from this builder.
- *
- * @param fieldName Field name.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder removeField(String fieldName);
-
- /**
- * Sets hash code for resulting portable object returned by {@link #build()} method.
- *
- * If not set {@code 0} is used.
- *
- * @param hashCode Hash code.
- * @return {@code this} instance for chaining.
- */
- public PortableBuilder hashCode(int hashCode);
-
- /**
- * Builds portable object.
- *
- * @return Portable object.
- * @throws PortableException In case of error.
- */
- public PortableObject build() throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
deleted file mode 100644
index 0f8d78b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableException.java
+++ /dev/null
@@ -1,57 +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.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.IgniteException;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating portable object serialization error.
- */
-public class PortableException extends IgniteException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates portable exception with error message.
- *
- * @param msg Error message.
- */
- public PortableException(String msg) {
- super(msg);
- }
-
- /**
- * Creates portable exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates portable exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableField.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableField.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableField.java
deleted file mode 100644
index 81a7424..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableField.java
+++ /dev/null
@@ -1,46 +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.
- */
-
-package org.apache.ignite.portable;
-
-/**
- * Portable object field. Can be used to speed object field lookup.
- */
-public interface PortableField {
- /**
- * Get field's name.
- *
- * @return Name.
- */
- public String name();
-
- /**
- * Check whether field exists in the object.
- *
- * @param obj Object.
- * @return {@code True} if exists.
- */
- public boolean exists(PortableObject obj);
-
- /**
- * Get field's value from the given object.
- *
- * @param obj Object.
- * @return Value.
- */
- public T value(PortableObject obj);
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
deleted file mode 100644
index 368e415..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableIdMapper.java
+++ /dev/null
@@ -1,56 +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.
- */
-
-package org.apache.ignite.portable;
-
-import org.apache.ignite.marshaller.portable.PortableMarshaller;
-
-/**
- * Type and field ID mapper for portable objects. Ignite never writes full
- * strings for field or type names. Instead, for performance reasons, Ignite
- * writes integer hash codes for type and field names. It has been tested that
- * hash code conflicts for the type names or the field names
- * within the same type are virtually non-existent and, to gain performance, it is safe
- * to work with hash codes. For the cases when hash codes for different types or fields
- * actually do collide {@code PortableIdMapper} allows to override the automatically
- * generated hash code IDs for the type and field names.
- *
- * Portable ID mapper can be configured for all portable objects via {@link PortableMarshaller#getIdMapper()} method,
- * or for a specific portable type via {@link PortableTypeConfiguration#getIdMapper()} method.
- */
-public interface PortableIdMapper {
- /**
- * Gets type ID for provided class name.
- *
- * If {@code 0} is returned, hash code of class simple name will be used.
- *
- * @param clsName Class name.
- * @return Type ID.
- */
- public int typeId(String clsName);
-
- /**
- * Gets ID for provided field.
- *
- * If {@code 0} is returned, hash code of field name will be used.
- *
- * @param typeId Type ID.
- * @param fieldName Field name.
- * @return Field ID.
- */
- public int fieldId(int typeId, String fieldName);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
deleted file mode 100644
index 0098ec3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableInvalidClassException.java
+++ /dev/null
@@ -1,58 +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.
- */
-
-package org.apache.ignite.portable;
-
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Exception indicating that class needed for deserialization of portable object does not exist.
- *
- * Thrown from {@link PortableObject#deserialize()} method.
- */
-public class PortableInvalidClassException extends PortableException {
- /** */
- private static final long serialVersionUID = 0L;
-
- /**
- * Creates invalid class exception with error message.
- *
- * @param msg Error message.
- */
- public PortableInvalidClassException(String msg) {
- super(msg);
- }
-
- /**
- * Creates invalid class exception with {@link Throwable} as a cause.
- *
- * @param cause Cause.
- */
- public PortableInvalidClassException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Creates invalid class exception with error message and {@link Throwable} as a cause.
- *
- * @param msg Error message.
- * @param cause Cause.
- */
- public PortableInvalidClassException(String msg, @Nullable Throwable cause) {
- super(msg, cause);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
deleted file mode 100644
index 4270885..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMarshalAware.java
+++ /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.
- */
-
-package org.apache.ignite.portable;
-
-/**
- * Interface that allows to implement custom serialization
- * logic for portable objects. Portable objects are not required
- * to implement this interface, in which case Ignite will automatically
- * serialize portable objects using reflection.
- *
- * This interface, in a way, is analogous to {@link java.io.Externalizable}
- * interface, which allows users to override default serialization logic,
- * usually for performance reasons. The only difference here is that portable
- * serialization is already very fast and implementing custom serialization
- * logic for portables does not provide significant performance gains.
- */
-public interface PortableMarshalAware {
- /**
- * Writes fields to provided writer.
- *
- * @param writer Portable object writer.
- * @throws PortableException In case of error.
- */
- public void writePortable(PortableWriter writer) throws PortableException;
-
- /**
- * Reads fields from provided reader.
- *
- * @param reader Portable object reader.
- * @throws PortableException In case of error.
- */
- public void readPortable(PortableReader reader) throws PortableException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b783d2b7/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java b/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
deleted file mode 100644
index 4ea808b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/portable/PortableMetadata.java
+++ /dev/null
@@ -1,61 +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.
- */
-
-package org.apache.ignite.portable;
-
-import java.util.Collection;
-import org.apache.ignite.IgnitePortables;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * Portable type meta data. Metadata for portable types can be accessed from any of the
- * {@link IgnitePortables#metadata(String)} methods.
- * Having metadata also allows for proper formatting of {@code PortableObject#toString()} method,
- * even when portable objects are kept in binary format only, which may be necessary for audit reasons.
- */
-public interface PortableMetadata {
- /**
- * Gets portable type name.
- *
- * @return Portable type name.
- */
- public String typeName();
-
- /**
- * Gets collection of all field names for this portable type.
- *
- * @return Collection of all field names for this portable type.
- */
- public Collection fields();
-
- /**
- * Gets name of the field type for a given field.
- *
- * @param fieldName Field name.
- * @return Field type name.
- */
- @Nullable public String fieldTypeName(String fieldName);
-
- /**
- * Portable objects can optionally specify custom key-affinity mapping in the
- * configuration. This method returns the name of the field which should be
- * used for the key-affinity mapping.
- *
- * @return Affinity key field name.
- */
- @Nullable public String affinityKeyFieldName();
-}
\ No newline at end of file