ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [08/50] [abbrv] incubator-ignite git commit: # IGNITE-32 GridCacheQueryTypeMetadata -> CacheTypeMetadata.
Date Thu, 05 Feb 2015 08:30:08 GMT
# IGNITE-32 GridCacheQueryTypeMetadata -> CacheTypeMetadata.


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

Branch: refs/heads/ignite-160
Commit: bff48f9cc0cc025fbbf7efa9ddf2b37f6ec5ebbe
Parents: 9b132b7
Author: AKuznetsov <akuznetsov@gridgain.com>
Authored: Wed Feb 4 13:40:42 2015 +0700
Committer: AKuznetsov <akuznetsov@gridgain.com>
Committed: Wed Feb 4 13:40:42 2015 +0700

----------------------------------------------------------------------
 .../src/test/resources/spring-server-node.xml   |   6 +-
 .../test/resources/spring-server-ssl-node.xml   |   6 +-
 .../java/org/apache/ignite/IgnitePortables.java |   4 +-
 .../cache/query/CacheQueryConfiguration.java    |  23 ---
 .../cache/query/CacheQueryTypeMetadata.java     | 206 -------------------
 .../ignite/cache/store/jdbc/JdbcCacheStore.java |   4 +-
 .../processors/query/GridQueryProcessor.java    |  36 ++--
 7 files changed, 28 insertions(+), 257 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/clients/src/test/resources/spring-server-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-node.xml b/modules/clients/src/test/resources/spring-server-node.xml
index ccfcf0f..09bc93a 100644
--- a/modules/clients/src/test/resources/spring-server-node.xml
+++ b/modules/clients/src/test/resources/spring-server-node.xml
@@ -156,7 +156,7 @@
                         <bean class="org.apache.ignite.cache.query.CacheQueryConfiguration">
                             <property name="typeMetadata">
                                 <list>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>
@@ -174,7 +174,7 @@
                                             </list>
                                         </property>
                                     </bean>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridImplicitPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>
@@ -187,7 +187,7 @@
                                             </map>
                                         </property>
                                     </bean>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridNoDefPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/clients/src/test/resources/spring-server-ssl-node.xml
----------------------------------------------------------------------
diff --git a/modules/clients/src/test/resources/spring-server-ssl-node.xml b/modules/clients/src/test/resources/spring-server-ssl-node.xml
index 68774da..4628d14 100644
--- a/modules/clients/src/test/resources/spring-server-ssl-node.xml
+++ b/modules/clients/src/test/resources/spring-server-ssl-node.xml
@@ -140,7 +140,7 @@
                         <bean class="org.apache.ignite.cache.query.CacheQueryConfiguration">
                             <property name="typeMetadata">
                                 <list>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>
@@ -158,7 +158,7 @@
                                             </list>
                                         </property>
                                     </bean>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridImplicitPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>
@@ -171,7 +171,7 @@
                                             </map>
                                         </property>
                                     </bean>
-                                    <bean class="org.apache.ignite.cache.query.CacheQueryTypeMetadata">
+                                    <bean class="org.apache.ignite.cache.CacheTypeMetadata">
                                         <property name="type" value="GridNoDefPortablePerson"/>
                                         <property name="ascendingFields">
                                             <map>

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java b/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
index 4da163e..bb13bb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgnitePortables.java
@@ -254,7 +254,7 @@ import java.util.Date;
  * or for a specific type via {@link org.apache.ignite.portables.PortableTypeConfiguration}
instance.
  * <h1 class="header">Query Indexing</h1>
  * Portable objects can be indexed for querying by specifying index fields in
- * {@link org.apache.ignite.cache.query.CacheQueryTypeMetadata} inside of specific {@link
CacheConfiguration} instance,
+ * {@link org.apache.ignite.cache.CacheTypeMetadata} inside of specific {@link CacheConfiguration}
instance,
  * like so:
  * <pre name=code class=xml>
  * ...
@@ -264,7 +264,7 @@ import java.util.Date;
  *         &lt;bean class="CacheQueryConfiguration"&gt;
  *             &lt;property name="typeMetadata"&gt;
  *                 &lt;list&gt;
- *                     &lt;bean class="CacheQueryTypeMetadata"&gt;
+ *                     &lt;bean class="CacheTypeMetadata"&gt;
  *                         &lt;property name="type" value="Employee"/&gt;
  *
  *                         &lt;!-- Fields to index in ascending order. --&gt;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryConfiguration.java
b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryConfiguration.java
index 9f1cb91..e96e222 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryConfiguration.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.cache.query;
 
 import java.io.*;
-import java.util.*;
 
 /**
  * Query configuration object.
@@ -27,9 +26,6 @@ public class CacheQueryConfiguration implements Serializable {
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** Collection of query type metadata. */
-    private Collection<CacheQueryTypeMetadata> typeMeta;
-
     /** Query type resolver. */
     private CacheQueryTypeResolver typeRslvr;
 
@@ -56,7 +52,6 @@ public class CacheQueryConfiguration implements Serializable {
      * @param cfg Configuration to copy.
      */
     public CacheQueryConfiguration(CacheQueryConfiguration cfg) {
-        typeMeta = cfg.getTypeMetadata();
         typeRslvr = cfg.getTypeResolver();
         idxPrimitiveKey = cfg.isIndexPrimitiveKey();
         idxPrimitiveVal = cfg.isIndexPrimitiveValue();
@@ -65,24 +60,6 @@ public class CacheQueryConfiguration implements Serializable {
     }
 
     /**
-     * Gets collection of query type metadata objects.
-     *
-     * @return Collection of query type metadata.
-     */
-    public Collection<CacheQueryTypeMetadata> getTypeMetadata() {
-        return typeMeta;
-    }
-
-    /**
-     * Sets collection of query type metadata objects.
-     *
-     * @param typeMeta Collection of query type metadata.
-     */
-    public void setTypeMetadata(Collection<CacheQueryTypeMetadata> typeMeta) {
-        this.typeMeta = typeMeta;
-    }
-
-    /**
      * Gets query type resolver.
      *
      * @return Query type resolver.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryTypeMetadata.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryTypeMetadata.java
b/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryTypeMetadata.java
deleted file mode 100644
index 55dc102..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/query/CacheQueryTypeMetadata.java
+++ /dev/null
@@ -1,206 +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.cache.query;
-
-import org.apache.ignite.internal.util.tostring.*;
-import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
-
-import java.util.*;
-
-/**
- * Cache query type metadata.
- */
-public class CacheQueryTypeMetadata {
-    /** Type name, e.g. class name. */
-    private String type;
-
-    /** Fields to be queried, in addition to indexed fields. */
-    @GridToStringInclude
-    private Map<String, Class<?>> qryFlds;
-
-    /** Fields to index in ascending order. */
-    @GridToStringInclude
-    private Map<String, Class<?>> ascFlds;
-
-    /** Fields to index in descending order. */
-    @GridToStringInclude
-    private Map<String, Class<?>> descFlds;
-
-    /** Fields to index as text. */
-    @GridToStringInclude
-    private Collection<String> txtFlds;
-
-    /** Fields to create group indexes for. */
-    @GridToStringInclude
-    private Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>>
grps;
-
-    /**
-     * Default constructor.
-     */
-    public CacheQueryTypeMetadata() {
-        qryFlds = new LinkedHashMap<>();
-
-        ascFlds = new LinkedHashMap<>();
-
-        descFlds = new LinkedHashMap<>();
-
-        txtFlds = new LinkedHashSet<>();
-
-        grps = new LinkedHashMap<>();
-    }
-
-    /**
-     * Copy constructor.
-     */
-    public CacheQueryTypeMetadata(CacheQueryTypeMetadata src) {
-        type = src.getType();
-
-        qryFlds = new LinkedHashMap<>(src.getQueryFields());
-
-        ascFlds = new LinkedHashMap<>(src.getAscendingFields());
-
-        descFlds = new LinkedHashMap<>(src.getDescendingFields());
-
-        txtFlds = new LinkedHashSet<>(src.getTextFields());
-
-        grps = new LinkedHashMap<>(src.getGroups());
-    }
-
-    /**
-     * Gets type (e.g. class name).
-     *
-     * @return Type name.
-     */
-    public String getType() {
-        return type;
-    }
-
-    /**
-     * Sets type.
-     *
-     * @param cls Type class.
-     */
-    public void setType(Class<?> cls) {
-        setType(cls.getName());
-    }
-
-    /**
-     * Sets type.
-     *
-     * @param type Type name.
-     */
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    /**
-     * Gets query-enabled fields.
-     *
-     * @return Collection of fields available for query.
-     */
-    public Map<String, Class<?>> getQueryFields() {
-        return qryFlds;
-    }
-
-    /**
-     * Sets query fields map.
-     *
-     * @param qryFlds Query fields.
-     */
-    public void setQueryFields(Map<String, Class<?>> qryFlds) {
-        this.qryFlds = qryFlds;
-    }
-
-    /**
-     * Gets ascending-indexed fields.
-     *
-     * @return Map of ascending-indexed fields.
-     */
-    public Map<String, Class<?>> getAscendingFields() {
-        return ascFlds;
-    }
-
-    /**
-     * Sets ascending-indexed fields.
-     *
-     * @param ascFlds Map of ascending-indexed fields.
-     */
-    public void setAscendingFields(Map<String, Class<?>> ascFlds) {
-        this.ascFlds = ascFlds;
-    }
-
-    /**
-     * Gets descending-indexed fields.
-     *
-     * @return Map of descending-indexed fields.
-     */
-    public Map<String, Class<?>> getDescendingFields() {
-        return descFlds;
-    }
-
-    /**
-     * Sets descending-indexed fields.
-     *
-     * @param descFlds Map of descending-indexed fields.
-     */
-    public void setDescendingFields(Map<String, Class<?>> descFlds) {
-        this.descFlds = descFlds;
-    }
-
-    /**
-     * Gets text-indexed fields.
-     *
-     * @return Collection of text indexed fields.
-     */
-    public Collection<String> getTextFields() {
-        return txtFlds;
-    }
-
-    /**
-     * Sets text-indexed fields.
-     *
-     * @param txtFlds Text-indexed fields.
-     */
-    public void setTextFields(Collection<String> txtFlds) {
-        this.txtFlds = txtFlds;
-    }
-
-    /**
-     * Gets group-indexed fields.
-     *
-     * @return Map of group-indexed fields.
-     */
-    public Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>>
getGroups() {
-        return grps;
-    }
-
-    /**
-     * Sets group-indexed fields.
-     *
-     * @param grps Map of group-indexed fields from index name to index fields.
-     */
-    public void setGroups(Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>,
Boolean>>> grps) {
-        this.grps = grps;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(CacheQueryTypeMetadata.class, this);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcCacheStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcCacheStore.java
b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcCacheStore.java
index 52a7bfc..47cc212 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcCacheStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/store/jdbc/JdbcCacheStore.java
@@ -437,8 +437,8 @@ public abstract class JdbcCacheStore<K, V> extends CacheStore<K,
V> implements L
         EntryMapping em = cacheMappings(cacheName).get(keyTypeId);
 
         if (em == null)
-            throw new CacheException("Failed to find mapping description [table = " + em.fullTableName()
+
-                ", key=" + key + ", cache=" + (cacheName != null ? cacheName : "<default>")
+ "]");
+            throw new CacheException("Failed to find mapping description [key=" + key +
+                ", cache=" + (cacheName != null ? cacheName : "<default>") + "]");
 
         return em;
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/bff48f9c/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 da89e49..eff84a8 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
@@ -66,10 +66,10 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     private final GridQueryIndexing idx;
 
     /** Configuration-declared types. */
-    private final Map<TypeName, CacheQueryTypeMetadata> declaredTypesByName = new HashMap<>();
+    private final Map<TypeName, CacheTypeMetadata> declaredTypesByName = new HashMap<>();
 
     /** Configuration-declared types. */
-    private Map<TypeId, CacheQueryTypeMetadata> declaredTypesById;
+    private Map<TypeId, CacheTypeMetadata> declaredTypesById;
 
     /** Portable IDs. */
     private Map<Integer, String> portableIds;
@@ -105,9 +105,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {
-                    if (!F.isEmpty(qryCfg.getTypeMetadata())) {
-                        for (CacheQueryTypeMetadata meta : qryCfg.getTypeMetadata())
-                            declaredTypesByName.put(new TypeName(ccfg.getName(), meta.getType()),
meta);
+                    if (!F.isEmpty(ccfg.getTypeMetadata())) {
+                        for (CacheTypeMetadata meta : ccfg.getTypeMetadata())
+                            declaredTypesByName.put(new TypeName(ccfg.getName(), meta.getValueType()),
meta);
                     }
 
                     if (qryCfg.getTypeResolver() != null)
@@ -330,14 +330,14 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                             String typeName = portableName(portableKey.typeId());
 
                             if (typeName != null) {
-                                CacheQueryTypeMetadata keyMeta = declaredType(space, portableKey.typeId());
+                                CacheTypeMetadata keyMeta = declaredType(space, portableKey.typeId());
 
                                 if (keyMeta != null)
                                     processPortableMeta(true, keyMeta, d);
                             }
                         }
                         else {
-                            CacheQueryTypeMetadata keyMeta = declaredType(space, keyCls.getName());
+                            CacheTypeMetadata keyMeta = declaredType(space, keyCls.getName());
 
                             if (keyMeta == null)
                                 processAnnotationsInClass(true, d.keyCls, d, null);
@@ -351,7 +351,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                             String typeName = portableName(portableVal.typeId());
 
                             if (typeName != null) {
-                                CacheQueryTypeMetadata valMeta = declaredType(space, portableVal.typeId());
+                                CacheTypeMetadata valMeta = declaredType(space, portableVal.typeId());
 
                                 d.name(typeName);
 
@@ -364,7 +364,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
                             d.name(valTypeName);
 
-                            CacheQueryTypeMetadata typeMeta = declaredType(space, valCls.getName());
+                            CacheTypeMetadata typeMeta = declaredType(space, valCls.getName());
 
                             if (typeMeta == null)
                                 processAnnotationsInClass(false, d.valCls, d, null);
@@ -536,8 +536,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {
-                    for (CacheQueryTypeMetadata meta : qryCfg.getTypeMetadata())
-                        portableIds.put(ctx.portable().typeId(meta.getType()), meta.getType());
+                    for (CacheTypeMetadata meta : ccfg.getTypeMetadata())
+                        portableIds.put(ctx.portable().typeId(meta.getValueType()), meta.getValueType());
                 }
             }
 
@@ -552,8 +552,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param typeId Type ID.
      * @return Type meta data if it was declared in configuration.
      */
-    @Nullable private CacheQueryTypeMetadata declaredType(String space, int typeId) {
-        Map<TypeId, CacheQueryTypeMetadata> declaredTypesById = this.declaredTypesById;
+    @Nullable private CacheTypeMetadata declaredType(String space, int typeId) {
+        Map<TypeId, CacheTypeMetadata> declaredTypesById = this.declaredTypesById;
 
         if (declaredTypesById == null) {
             declaredTypesById = new HashMap<>();
@@ -562,8 +562,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 CacheQueryConfiguration qryCfg = ccfg.getQueryConfiguration();
 
                 if (qryCfg != null) {
-                    for (CacheQueryTypeMetadata meta : qryCfg.getTypeMetadata())
-                        declaredTypesById.put(new TypeId(ccfg.getName(), ctx.portable().typeId(meta.getType())),
meta);
+                    for (CacheTypeMetadata meta : ccfg.getTypeMetadata())
+                        declaredTypesById.put(new TypeId(ccfg.getName(), ctx.portable().typeId(meta.getValueType())),
meta);
                 }
             }
 
@@ -578,7 +578,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param typeName Type name.
      * @return Type meta data if it was declared in configuration.
      */
-    @Nullable private CacheQueryTypeMetadata declaredType(String space, String typeName)
{
+    @Nullable private CacheTypeMetadata declaredType(String space, String typeName) {
         return declaredTypesByName.get(new TypeName(space, typeName));
     }
 
@@ -848,7 +848,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param d Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    static void processClassMeta(boolean key, Class<?> cls, CacheQueryTypeMetadata
meta, TypeDescriptor d)
+    static void processClassMeta(boolean key, Class<?> cls, CacheTypeMetadata meta,
TypeDescriptor d)
         throws IgniteCheckedException {
         for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet())
{
             ClassProperty prop = buildClassProperty(cls, entry.getKey(), entry.getValue());
@@ -921,7 +921,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * @param d Type descriptor.
      * @throws IgniteCheckedException If failed.
      */
-    static void processPortableMeta(boolean key, CacheQueryTypeMetadata meta, TypeDescriptor
d)
+    static void processPortableMeta(boolean key, CacheTypeMetadata meta, TypeDescriptor d)
         throws IgniteCheckedException {
         for (Map.Entry<String, Class<?>> entry : meta.getAscendingFields().entrySet())
{
             PortableProperty prop = buildPortableProperty(entry.getKey(), entry.getValue());


Mime
View raw message