org.apache.ignite.internal

## Class MarshallerContextImpl

- java.lang.Object
- - org.apache.ignite.internal.MarshallerContextImpl

All Implemented Interfaces:
  MarshallerContext

    public class MarshallerContextImpl
    extends Object
    implements MarshallerContext

Marshaller context implementation.

### Constructor Summary

Constructors
Constructor and Description
`MarshallerContextImpl(Collection<PluginProvider> plugins)` Initializes context.

### Method Summary

Methods
`void` `checkHasClassName(String clsName, ClassLoader ldr, String fileName)`
`Iterator<Map.Entry<Byte,Map<Integer,String>>>` `currentMappings()` Method collects current mappings for all platforms.
`ArrayList<Map<Integer,MappedName>>` `getCachedMappings()`
`Class` `getClass(int typeId, ClassLoader ldr)` Gets class for provided type ID.
`String` `getClassName(byte platformId, int typeId)` Gets class name for provided (platformId, typeId) pair.
`boolean` `isSystemType(String typeName)` Checks whether the given type is a system one - JDK class or Ignite class.
`void` `onMappingAccepted(MarshallerMappingItem item)`
`void` `onMappingDataReceived(byte platformId, Map<Integer,MappedName> marshallerMappings)`
`String` `onMappingProposed(MarshallerMappingItem item)`
`void` `onMarshallerProcessorStarted(GridKernalContext ctx, MarshallerMappingTransport transport)`
`void` `onMarshallerProcessorStop()`
`void` `onMissedMappingResolved(MarshallerMappingItem item, String resolvedClsName)`
`boolean` `registerClassName(byte platformId, int typeId, String clsName)` Registers class with provided type ID.
`String` `resolveMissedMapping(byte platformId, int typeId)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MarshallerContextImpl

    public MarshallerContextImpl(@Nullable
                         Collection<PluginProvider> plugins)

Initializes context.

Parameters:
  `plugins` - Plugins.

### Method Detail

#### getCachedMappings

    public ArrayList<Map<Integer,MappedName>> getCachedMappings()

#### onMappingDataReceived

    public void onMappingDataReceived(byte platformId,
                             Map<Integer,MappedName> marshallerMappings)

Parameters:
  `platformId` - Platform id.
  `marshallerMappings` - All marshaller mappings for given platformId.

#### checkHasClassName

    public void checkHasClassName(String clsName,
                         ClassLoader ldr,
                         String fileName)

Parameters:
  `clsName` - Class name.
  `ldr` - Class loader used to get properties file.
  `fileName` - File name.

#### registerClassName

    public boolean registerClassName(byte platformId,
                            int typeId,
                            String clsName)
                              throws IgniteCheckedException

Registers class with provided type ID.

Specified by:
  `registerClassName` in interface `MarshallerContext`
Parameters:
  `platformId` - id of a platform to register class.
  `typeId` - Type ID.
  `clsName` - class name.
Returns:
  Whether class was registered.
Throws:
  `IgniteCheckedException` - In case of error.

#### onMappingProposed

    public String onMappingProposed(MarshallerMappingItem item)

Parameters:
  `item` - type mapping to propose
Returns:
  null if cache doesn't contain any mappings for given (platformId, typeId) pair, previous class name otherwise.

#### onMappingAccepted

    public void onMappingAccepted(MarshallerMappingItem item)

Parameters:
  `item` - Item.

#### getClass

    public Class getClass(int typeId,
                 ClassLoader ldr)
                   throws ClassNotFoundException,
                          IgniteCheckedException

Gets class for provided type ID.

Specified by:
  `getClass` in interface `MarshallerContext`
Parameters:
  `typeId` - Type ID.
  `ldr` - Class loader.
Returns:
  Class.
Throws:
  `ClassNotFoundException` - If class was not found.
  `IgniteCheckedException` - In case of any other error.

#### getClassName

    public String getClassName(byte platformId,
                      int typeId)
                        throws ClassNotFoundException,
                               IgniteCheckedException

Gets class name for provided (platformId, typeId) pair.

Specified by:
  `getClassName` in interface `MarshallerContext`
Parameters:
  `platformId` - id of a platform the class was registered for.
  `typeId` - Type ID.
Returns:
  Class name
Throws:
  `ClassNotFoundException` - If class was not found.
  `IgniteCheckedException` - In case of any other error.

#### resolveMissedMapping

    public String resolveMissedMapping(byte platformId,
                              int typeId)

Parameters:
  `platformId` - Platform id.
  `typeId` - Type id.

#### onMissedMappingResolved

    public void onMissedMappingResolved(MarshallerMappingItem item,
                               String resolvedClsName)

Parameters:
  `item` - Item.
  `resolvedClsName` - Resolved class name.

#### isSystemType

    public boolean isSystemType(String typeName)

Checks whether the given type is a system one - JDK class or Ignite class.

Specified by:
  `isSystemType` in interface `MarshallerContext`
Parameters:
  `typeName` - Type name.
Returns:
  `true` if the type is a system one, `false` otherwise.

#### onMarshallerProcessorStarted

    public void onMarshallerProcessorStarted(GridKernalContext ctx,
                                    MarshallerMappingTransport transport)
                                      throws IgniteCheckedException

Parameters:
  `ctx` - Context.
  `transport` - Transport.
Throws:
  `IgniteCheckedException`

#### onMarshallerProcessorStop

    public void onMarshallerProcessorStop()

#### currentMappings

    public Iterator<Map.Entry<Byte,Map<Integer,String>>> currentMappings()

Method collects current mappings for all platforms.

Returns:
  current mappings.

2017 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.0.0
Release Date | : April 30 2017