use of org.apache.ignite.internal.binary.BinaryMetadata in project ignite by apache.
the class PlatformContextImpl method writeMetadata0.
/**
* Write binary metadata.
*
* @param writer Writer.
* @param meta Metadata.
*/
private void writeMetadata0(BinaryRawWriterEx writer, BinaryType meta, boolean includeSchemas) {
if (meta == null)
writer.writeBoolean(false);
else {
writer.writeBoolean(true);
BinaryMetadata meta0 = ((BinaryTypeImpl) meta).metadata();
PlatformUtils.writeBinaryMetadata(writer, meta0, includeSchemas);
}
}
use of org.apache.ignite.internal.binary.BinaryMetadata in project ignite by apache.
the class PlatformContextImpl method processMetadata.
/**
* {@inheritDoc}
*/
@Override
public void processMetadata(BinaryRawReaderEx reader) {
Collection<BinaryMetadata> metas = PlatformUtils.readBinaryMetadataCollection(reader);
BinaryContext binCtx = cacheObjProc.binaryContext();
for (BinaryMetadata meta : metas) binCtx.updateMetadata(meta.typeId(), meta, false);
}
use of org.apache.ignite.internal.binary.BinaryMetadata in project ignite by apache.
the class JdbcBinaryTypePutRequest method readBinary.
/**
* {@inheritDoc}
*/
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
super.readBinary(reader, protoCtx);
meta = new BinaryMetadata();
try {
meta.readFrom(reader);
} catch (IOException e) {
throw new BinaryObjectException(e);
}
}
use of org.apache.ignite.internal.binary.BinaryMetadata in project ignite by apache.
the class ClientBinary method buildEnum.
/**
* {@inheritDoc}
*/
@Override
public BinaryObject buildEnum(String typeName, String name) {
if (typeName == null || typeName.isEmpty())
throw new IllegalArgumentException("typeName");
if (name == null || name.isEmpty())
throw new IllegalArgumentException("name");
BinaryContext ctx = marsh.context();
int typeId = ctx.typeId(typeName);
BinaryMetadata metadata = ctx.metadata0(typeId);
if (metadata == null)
throw new BinaryObjectException(String.format("Failed to get metadata for type [typeId=%s, typeName='%s']", typeId, typeName));
Integer ordinal = metadata.getEnumOrdinalByName(name);
if (ordinal == null)
throw new BinaryObjectException(String.format("Failed to resolve enum ordinal by name [typeId=%s, typeName='%s', name='%s']", typeId, typeName, name));
return new BinaryEnumObjectImpl(ctx, typeId, null, ordinal);
}
use of org.apache.ignite.internal.binary.BinaryMetadata in project ignite by apache.
the class ClientBinary method registerEnum.
/**
* {@inheritDoc}
*/
@Override
public BinaryType registerEnum(String typeName, Map<String, Integer> vals) {
if (typeName == null || typeName.isEmpty())
throw new IllegalArgumentException("typeName");
BinaryContext ctx = marsh.context();
int typeId = ctx.typeId(typeName);
ctx.updateMetadata(typeId, new BinaryMetadata(typeId, typeName, null, null, null, true, vals), false);
return ctx.metadata(typeId);
}
Aggregations