public class BinaryContext extends Object
| Constructor and Description |
|---|
BinaryContext(BinaryMetadataHandler metaHnd,
IgniteConfiguration igniteCfg,
IgniteLogger log) |
| Modifier and Type | Method and Description |
|---|---|
static String |
affinityFieldName(Class cls) |
String |
affinityKeyFieldName(int typeId)
Get affinity key field name for type.
|
byte |
collectionType(Class<? extends Collection> cls) |
IgniteConfiguration |
configuration() |
void |
configure(BinaryMarshaller marsh) |
void |
configure(BinaryMarshaller marsh,
BinaryConfiguration binaryCfg) |
BinaryFieldImpl |
createField(int typeId,
String fieldName)
Create binary field.
|
static BinaryIdMapper |
defaultIdMapper() |
static BinaryInternalMapper |
defaultMapper() |
static BinaryNameMapper |
defaultNameMapper() |
@NotNull BinaryClassDescriptor |
descriptorForClass(Class<?> cls) |
BinaryClassDescriptor |
descriptorForTypeId(boolean userType,
int typeId,
ClassLoader ldr,
boolean registerMeta) |
int |
fieldId(int typeId,
String fieldName) |
BinaryIdentityResolver |
identity(int typeId) |
boolean |
isCompactFooter() |
IgniteLogger |
log() |
byte |
mapType(Class<? extends Map> cls) |
BinaryMarshaller |
marshaller() |
Collection<BinaryType> |
metadata() |
@Nullable BinaryType |
metadata(int typeId) |
BinaryType |
metadata(int typeId,
int schemaId) |
@Nullable BinaryMetadata |
metadata0(int typeId) |
boolean |
mustDeserialize(Class cls)
Check whether class must be deserialized anyway.
|
void |
onUndeploy(ClassLoader ldr)
Undeployment callback invoked when class loader is being undeployed.
|
@NotNull BinaryClassDescriptor |
registerClass(Class<?> cls,
boolean registerMeta,
boolean failIfUnregistered)
Attempts registration of the provided class.
|
@NotNull BinaryClassDescriptor |
registerClass(Class<?> cls,
boolean registerMeta,
boolean failIfUnregistered,
boolean onlyLocReg) |
void |
registerClassLocally(BinaryType binaryType,
boolean failIfUnregistered,
byte platformId)
Registers binary type locally.
|
@NotNull BinaryClassDescriptor |
registerDescriptor(BinaryClassDescriptor desc,
boolean registerMeta,
boolean onlyLocReg)
Attempts registration of the provided
BinaryClassDescriptor in the cluster. |
BinaryClassDescriptor |
registerPredefinedType(Class<?> cls,
int id) |
BinaryClassDescriptor |
registerPredefinedType(Class<?> cls,
int id,
String affFieldName,
boolean registered) |
boolean |
registerUserClassName(int typeId,
String clsName,
boolean failIfUnregistered,
boolean onlyLocReg,
byte platformId)
Register "type ID to class name" mapping on all nodes to allow for mapping requests resolution form client.
|
void |
registerUserType(String clsName,
BinaryInternalMapper mapper,
@Nullable BinarySerializer serializer,
@Nullable BinaryIdentityResolver identity,
@Nullable String affKeyFieldName,
boolean isEnum,
@Nullable Map<String,Integer> enumMap) |
void |
registerUserTypesSchema()
Register user types schemas.
|
void |
removeType(int typeId) |
BinarySchemaRegistry |
schemaRegistry(int typeId)
Get schema registry for type ID.
|
int |
typeId(String typeName) |
void |
unregisterBinarySchemas()
Unregister all binary schemas.
|
void |
unregisterUserTypeDescriptors()
Unregisters the user types descriptors.
|
void |
updateMetadata(int typeId,
BinaryMetadata meta,
boolean failIfUnregistered) |
String |
userTypeName(String clsName) |
public BinaryContext(BinaryMetadataHandler metaHnd, IgniteConfiguration igniteCfg, IgniteLogger log)
metaHnd - Meta data handler.igniteCfg - Ignite configuration.log - Logger.public IgniteLogger log()
public BinaryMarshaller marshaller()
public boolean mustDeserialize(Class cls)
cls - Class.True if must be deserialized.public IgniteConfiguration configuration()
public void configure(BinaryMarshaller marsh) throws BinaryObjectException
marsh - Binary marshaller.BinaryObjectException - In case of error.public void configure(BinaryMarshaller marsh, BinaryConfiguration binaryCfg) throws BinaryObjectException
marsh - Binary marshaller.binaryCfg - Binary configuration.BinaryObjectException - In case of error.public static BinaryInternalMapper defaultMapper()
public static BinaryIdMapper defaultIdMapper()
public static BinaryNameMapper defaultNameMapper()
@NotNull public @NotNull BinaryClassDescriptor registerClass(Class<?> cls, boolean registerMeta, boolean failIfUnregistered) throws BinaryObjectException
cls - Class to register.registerMeta - If true, then metadata will be registered along with the class descriptor.failIfUnregistered - Throw exception if class isn't registered.BinaryObjectException - In case of error.@NotNull public @NotNull BinaryClassDescriptor registerClass(Class<?> cls, boolean registerMeta, boolean failIfUnregistered, boolean onlyLocReg) throws BinaryObjectException
cls - Class.failIfUnregistered - Throw exception if class isn't registered.registerMeta - If true, then metadata will be registered along with the class descriptor.onlyLocReg - true if descriptor need to register only locally when registration is required at all.BinaryObjectException - In case of error.public void registerClassLocally(BinaryType binaryType, boolean failIfUnregistered, byte platformId)
binaryType - Binary type to register.failIfUnregistered - Whether to fail when not registered.platformId - Platform ID (see MarshallerPlatformIds).@NotNull public @NotNull BinaryClassDescriptor descriptorForClass(Class<?> cls)
cls - Class.BinaryClassDescriptor.registered() will be false.public BinaryClassDescriptor descriptorForTypeId(boolean userType, int typeId, ClassLoader ldr, boolean registerMeta)
userType - User type or not.typeId - Type ID.ldr - Class loader.registerMeta - If true, then metadata will be registered along with the type descriptor.@NotNull public @NotNull BinaryClassDescriptor registerDescriptor(BinaryClassDescriptor desc, boolean registerMeta, boolean onlyLocReg)
BinaryClassDescriptor in the cluster.desc - Class descriptor to register.registerMeta - If true, then metadata will be registered along with the class descriptor.onlyLocReg - true if descriptor need to register only locally when registration is required at all.public byte collectionType(Class<? extends Collection> cls)
cls - Collection class.public byte mapType(Class<? extends Map> cls)
cls - Map class.public int typeId(String typeName)
typeName - Type name.public int fieldId(int typeId,
String fieldName)
typeId - Type ID.fieldName - Field name.public String userTypeName(String clsName)
clsName - Class name.public static String affinityFieldName(Class cls)
cls - Class to get affinity field for.null if field name was not found.public BinaryClassDescriptor registerPredefinedType(Class<?> cls, int id)
cls - Class.id - Type ID.public BinaryClassDescriptor registerPredefinedType(Class<?> cls, int id, String affFieldName, boolean registered)
cls - Class.id - Type ID.affFieldName - Affinity field name.public void registerUserType(String clsName, BinaryInternalMapper mapper, @Nullable @Nullable BinarySerializer serializer, @Nullable @Nullable BinaryIdentityResolver identity, @Nullable @Nullable String affKeyFieldName, boolean isEnum, @Nullable @Nullable Map<String,Integer> enumMap) throws BinaryObjectException
clsName - Class name.mapper - ID mapper.serializer - Serializer.identity - Type identity.affKeyFieldName - Affinity key field name.isEnum - If enum.enumMap - Enum name to ordinal mapping.BinaryObjectException - In case of error.public void registerUserTypesSchema()
public boolean registerUserClassName(int typeId,
String clsName,
boolean failIfUnregistered,
boolean onlyLocReg,
byte platformId)
BinaryContext's "register" methods and method
registerClass(Class, boolean, boolean) already call this functionality
so use this method only when registering class names whose Class is unknown.typeId - Type ID.clsName - Class Name.failIfUnregistered - If true then throw UnregisteredBinaryTypeException with MappingExchangeResult future instead of synchronously awaiting
for its completion.onlyLocReg - Whether to register only on the current node.platformId - Platform ID (see MarshallerPlatformIds).True if the mapping was registered successfully.public BinaryFieldImpl createField(int typeId, String fieldName)
typeId - Type ID.fieldName - Field name.@Nullable public @Nullable BinaryType metadata(int typeId) throws BinaryObjectException
typeId - Type ID.BinaryObjectException - In case of error.@Nullable public @Nullable BinaryMetadata metadata0(int typeId) throws BinaryObjectException
typeId - Type IDBinaryObjectException - In case of error.public Collection<BinaryType> metadata() throws BinaryObjectException
BinaryObjectExceptionpublic BinaryType metadata(int typeId, int schemaId) throws BinaryObjectException
typeId - Type ID.schemaId - Schema ID.BinaryObjectException - In case of error.public String affinityKeyFieldName(int typeId)
typeId - Type ID.public BinaryIdentityResolver identity(int typeId)
typeId - Type ID.public void updateMetadata(int typeId,
BinaryMetadata meta,
boolean failIfUnregistered)
throws BinaryObjectException
typeId - Type ID.meta - Meta data.failIfUnregistered - Fail if unregistered.BinaryObjectException - In case of error.public boolean isCompactFooter()
public BinarySchemaRegistry schemaRegistry(int typeId)
typeId - Type ID.public void unregisterBinarySchemas()
public void unregisterUserTypeDescriptors()
public void onUndeploy(ClassLoader ldr)
ldr - Class loader being undeployed.public void removeType(int typeId)
typeId - Type ID.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023