public class QueryUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
QueryUtils.KeyOrValProperty
Property used for keyFieldName or valueFieldName
|
Modifier and Type | Field and Description |
---|---|
static String |
KEY_FIELD_NAME
Field name for key.
|
static String |
VAL_FIELD_NAME
Field name for value.
|
static String |
VER_FIELD_NAME
Version field name.
|
Modifier and Type | Method and Description |
---|---|
static QueryBinaryProperty |
buildBinaryProperty(GridKernalContext ctx,
String pathStr,
Class<?> resType,
Map<String,String> aliases,
Boolean isKeyField)
Builds binary object property.
|
static QueryClassProperty |
buildClassProperty(boolean key,
Class<?> cls,
String pathStr,
Class<?> resType,
Map<String,String> aliases,
CacheObjectContext coCtx) |
static QueryClassProperty |
buildClassProperty(Class<?> keyCls,
Class<?> valCls,
String pathStr,
Class<?> resType,
Map<String,String> aliases,
CacheObjectContext coCtx) |
static GridQueryProperty |
buildProperty(Class<?> keyCls,
Class<?> valCls,
String keyFieldName,
String valueFieldName,
String pathStr,
Class<?> resType,
Map<String,String> aliases,
CacheObjectContext coCtx) |
static QueryIndexDescriptorImpl |
createIndexDescriptor(QueryTypeDescriptorImpl typeDesc,
QueryIndex idx)
Create index descriptor.
|
static int |
discoveryHistorySize()
Discovery history size.
|
static String |
indexName(QueryEntity entity,
QueryIndex idx)
Get index name.
|
static String |
indexName(String tblName,
QueryIndex idx)
Get index name.
|
static boolean |
isEnabled(CacheConfiguration<?,?> ccfg) |
static boolean |
isGeometryClass(Class<?> cls)
Checks if the given class is GEOMETRY.
|
static boolean |
isSqlType(Class<?> cls)
Checks if the given class can be mapped to a simple SQL type.
|
static void |
prepareCacheConfiguration(CacheConfiguration ccfg)
Prepare cache configuration.
|
static void |
processBinaryMeta(GridKernalContext ctx,
QueryEntity qryEntity,
QueryTypeDescriptorImpl d)
Processes declarative metadata for binary object.
|
static void |
processClassMeta(QueryEntity qryEntity,
QueryTypeDescriptorImpl d,
CacheObjectContext coCtx)
Processes declarative metadata for binary object.
|
static void |
processDynamicIndexChange(String idxName,
QueryIndex idx,
QueryTypeDescriptorImpl d)
Process dynamic index change.
|
static String |
propertyInitializationExceptionMessage(Class<?> keyCls,
Class<?> valCls,
String pathStr,
Class<?> resType)
Exception message to compare in tests.
|
static String |
tableName(QueryEntity entity)
Get table name for entity.
|
static QueryTypeCandidate |
typeForQueryEntity(String space,
GridCacheContext cctx,
QueryEntity qryEntity,
List<Class<?>> mustDeserializeClss)
Create type candidate for query entity.
|
static String |
typeName(Class<?> cls)
Gets type name by class.
|
static String |
typeName(String clsName)
Gets type name by class.
|
static void |
validateCacheConfiguration(CacheConfiguration ccfg)
Prepare cache configuration.
|
static int |
validateTimeout(int timeout,
TimeUnit timeUnit) |
static SchemaOperationException |
wrapIfNeeded(Exception e)
Wrap schema exception if needed.
|
public static final String KEY_FIELD_NAME
public static final String VAL_FIELD_NAME
public static final String VER_FIELD_NAME
public static String tableName(QueryEntity entity)
entity
- Entity.public static String indexName(QueryEntity entity, QueryIndex idx)
entity
- Query entity.idx
- Index.public static String indexName(String tblName, QueryIndex idx)
tblName
- Table name.idx
- Index.public static QueryTypeCandidate typeForQueryEntity(String space, GridCacheContext cctx, QueryEntity qryEntity, List<Class<?>> mustDeserializeClss) throws IgniteCheckedException
space
- Space.cctx
- Cache context.qryEntity
- Query entity.mustDeserializeClss
- Classes which must be deserialized.IgniteCheckedException
- If failed.public static void processBinaryMeta(GridKernalContext ctx, QueryEntity qryEntity, QueryTypeDescriptorImpl d) throws IgniteCheckedException
ctx
- Kernal context.qryEntity
- Declared metadata.d
- Type descriptor.IgniteCheckedException
- If failed.public static void processClassMeta(QueryEntity qryEntity, QueryTypeDescriptorImpl d, CacheObjectContext coCtx) throws IgniteCheckedException
qryEntity
- Declared metadata.d
- Type descriptor.IgniteCheckedException
- If failed.public static void processDynamicIndexChange(String idxName, @Nullable QueryIndex idx, QueryTypeDescriptorImpl d) throws IgniteCheckedException
idx
- Index.d
- Type descriptor to populate.IgniteCheckedException
- If failed to build index information.public static QueryIndexDescriptorImpl createIndexDescriptor(QueryTypeDescriptorImpl typeDesc, QueryIndex idx) throws IgniteCheckedException
typeDesc
- Type descriptor.idx
- Index.IgniteCheckedException
- If failed.public static QueryBinaryProperty buildBinaryProperty(GridKernalContext ctx, String pathStr, Class<?> resType, Map<String,String> aliases, @Nullable Boolean isKeyField) throws IgniteCheckedException
ctx
- Kernal context.pathStr
- String representing path to the property. May contains dots '.' to identify
nested fields.resType
- Result type.aliases
- Aliases.isKeyField
- Key ownership flag, as defined in QueryEntity.keyFields
: true
if field belongs
to key, false
if it belongs to value, null
if QueryEntity#keyFields is null.IgniteCheckedException
public static QueryClassProperty buildClassProperty(Class<?> keyCls, Class<?> valCls, String pathStr, Class<?> resType, Map<String,String> aliases, CacheObjectContext coCtx) throws IgniteCheckedException
keyCls
- Key class.valCls
- Value class.pathStr
- Path string.resType
- Result type.aliases
- Aliases.IgniteCheckedException
- If failed.public static GridQueryProperty buildProperty(Class<?> keyCls, Class<?> valCls, String keyFieldName, String valueFieldName, String pathStr, Class<?> resType, Map<String,String> aliases, CacheObjectContext coCtx) throws IgniteCheckedException
keyCls
- Key class.valCls
- Value class.keyFieldName
- Key Field.valueFieldName
- Value Field.pathStr
- Path string.resType
- Result type.aliases
- Aliases.IgniteCheckedException
- If failed.public static String propertyInitializationExceptionMessage(Class<?> keyCls, Class<?> valCls, String pathStr, Class<?> resType)
keyCls
- key classvalCls
- value classpathStr
- property nameresType
- property typepublic static QueryClassProperty buildClassProperty(boolean key, Class<?> cls, String pathStr, Class<?> resType, Map<String,String> aliases, CacheObjectContext coCtx)
key
- If this is a key property.cls
- Source type class.pathStr
- String representing path to the property. May contains dots '.' to identify nested fields.resType
- Expected result type.aliases
- Aliases.public static boolean isSqlType(Class<?> cls)
cls
- Class.true
If can.public static boolean isGeometryClass(Class<?> cls)
cls
- Class.true
If this is geometry.public static String typeName(String clsName)
clsName
- Class name.public static String typeName(Class<?> cls)
cls
- Class.public static int validateTimeout(int timeout, TimeUnit timeUnit)
timeout
- Timeout.timeUnit
- Time unit.public static boolean isEnabled(CacheConfiguration<?,?> ccfg)
ccfg
- Cache configuration.true
If query index must be enabled for this cache.public static int discoveryHistorySize()
@Nullable public static SchemaOperationException wrapIfNeeded(@Nullable Exception e)
e
- Original exception.public static void prepareCacheConfiguration(CacheConfiguration ccfg)
ccfg
- Cache configuration.public static void validateCacheConfiguration(CacheConfiguration ccfg) throws IgniteCheckedException
ccfg
- Cache configuration.IgniteCheckedException
- If failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017