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 |
DFLT_SCHEMA
Default schema.
|
static String |
KEY_FIELD_NAME
Field name for key.
|
static String |
TEMPLATE_PARTITIONED
Well-known template name for PARTITIONED cache.
|
static String |
TEMPLATE_REPLICÄTED
Well-known template name for REPLICATED cache.
|
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 SchemaOperationException |
checkQueryEntityConflicts(CacheConfiguration<?,?> ccfg,
Collection<DynamicCacheDescriptor> descs)
Check given
CacheConfiguration for conflicts in table and index names from any query entities
found in collection of DynamicCacheDescriptors and belonging to the same schema. |
static QueryIndexDescriptorImpl |
createIndexDescriptor(QueryTypeDescriptorImpl typeDesc,
QueryIndex idx)
Create index descriptor.
|
static String |
createTableCacheName(String schemaName,
String tblName)
Construct cache name for table.
|
static String |
createTableKeyTypeName(String valTypeName)
Construct key type name for table.
|
static String |
createTableValueTypeName(String schemaName,
String tblName)
Construct value type name for table.
|
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 String |
normalizeObjectName(String str,
boolean replace)
Normalize object name.
|
static QueryEntity |
normalizeQueryEntity(QueryEntity entity,
boolean escape)
Normalize query entity.
|
static String |
normalizeSchemaName(String cacheName,
String schemaName)
Stores rule for constructing schemaName according to 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 cacheName,
GridCacheContext cctx,
QueryEntity qryEntity,
List<Class<?>> mustDeserializeClss,
boolean escape)
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 int |
validateTimeout(int timeout,
TimeUnit timeUnit) |
static SchemaOperationException |
wrapIfNeeded(Exception e)
Wrap schema exception if needed.
|
public static final String DFLT_SCHEMA
public static final String KEY_FIELD_NAME
public static final String VAL_FIELD_NAME
public static final String VER_FIELD_NAME
public static final String TEMPLATE_PARTITIONED
public static final String TEMPLATE_REPLICÄTED
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 QueryEntity normalizeQueryEntity(QueryEntity entity, boolean escape)
entity - Query entity.escape - Escape flag taken form configuration.public static String normalizeSchemaName(String cacheName, @Nullable String schemaName)
cacheName - Cache name.schemaName - Schema name.@Nullable public static String normalizeObjectName(@Nullable String str, boolean replace)
str - String.replace - Whether to perform replace of special characters.public static QueryTypeCandidate typeForQueryEntity(String cacheName, GridCacheContext cctx, QueryEntity qryEntity, List<Class<?>> mustDeserializeClss, boolean escape) throws IgniteCheckedException
cacheName - Cache name.cctx - Cache context.qryEntity - Query entity.mustDeserializeClss - Classes which must be deserialized.escape - Escape flag.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.IgniteCheckedExceptionpublic 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 SchemaOperationException checkQueryEntityConflicts(CacheConfiguration<?,?> ccfg, Collection<DynamicCacheDescriptor> descs)
CacheConfiguration for conflicts in table and index names from any query entities
found in collection of DynamicCacheDescriptors and belonging to the same schema.ccfg - New cache configuration.descs - Cache descriptors.null if none found.public static String createTableCacheName(String schemaName, String tblName)
schemaName - Schema name.tblName - Table name.public static String createTableValueTypeName(String schemaName, String tblName)
schemaName - Schema name.tblName - Table name.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.2.0 Release Date : September 15 2017