Search in sources :

Example 11 with BinaryTypeImpl

use of org.apache.ignite.internal.binary.BinaryTypeImpl in project ignite by apache.

the class PlatformUtils method getSchema.

/**
 * Gets the schema.
 *
 * @param cacheObjProc Cache object processor.
 * @param typeId Type id.
 * @param schemaId Schema id.
 */
public static int[] getSchema(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) {
    assert cacheObjProc != null;
    BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId);
    BinarySchema schema = schemaReg.schema(schemaId);
    if (schema == null) {
        BinaryTypeImpl meta = (BinaryTypeImpl) cacheObjProc.metadata(typeId);
        if (meta != null) {
            for (BinarySchema typeSchema : meta.metadata().schemas()) {
                if (schemaId == typeSchema.schemaId()) {
                    schema = typeSchema;
                    break;
                }
            }
        }
        if (schema != null) {
            schemaReg.addSchema(schemaId, schema);
        }
    }
    return schema == null ? null : schema.fieldIds();
}
Also used : BinaryTypeImpl(org.apache.ignite.internal.binary.BinaryTypeImpl) BinarySchema(org.apache.ignite.internal.binary.BinarySchema) BinarySchemaRegistry(org.apache.ignite.internal.binary.BinarySchemaRegistry)

Aggregations

BinaryTypeImpl (org.apache.ignite.internal.binary.BinaryTypeImpl)11 BinaryMetadata (org.apache.ignite.internal.binary.BinaryMetadata)9 HashMap (java.util.HashMap)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 BinaryObjectException (org.apache.ignite.binary.BinaryObjectException)3 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 BinaryObject (org.apache.ignite.binary.BinaryObject)2 BinaryType (org.apache.ignite.binary.BinaryType)2 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)2 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)2 BinaryContext (org.apache.ignite.internal.binary.BinaryContext)2 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)2 BinaryMetadataHandler (org.apache.ignite.internal.binary.BinaryMetadataHandler)2 BinarySchema (org.apache.ignite.internal.binary.BinarySchema)2 BinarySchemaRegistry (org.apache.ignite.internal.binary.BinarySchemaRegistry)2 GridBinaryMarshaller (org.apache.ignite.internal.binary.GridBinaryMarshaller)2 CacheObject (org.apache.ignite.internal.processors.cache.CacheObject)2 KeyCacheObject (org.apache.ignite.internal.processors.cache.KeyCacheObject)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1