This package contains the plug-in interfaces and classes for building customized data serializers.

Overview

WebSphere eXtreme Scale allows storing data in native object form or in it's serialized form. The interfaces in this package allow for custom serialized formats to be stored in the grid, providing metadata and data access methods to allow queries and indexes to introspect portions of the serialized form of the object without requiring the object to be fully inflated.

To build a custom serializer, implement the KeySerializerPlugin and/or the ValueSerializerPlugin interfaces.

To build a custom serializer that works with the HashIndex plug-in and query, the DataSerializer implementations must build and return a DataDescriptor. The DataDescriptor is defined in the {@link com.ibm.websphere.objectgrid.plugins.io.datadescriptor.DataDescriptor} class and package.

To enable eXtreme Scale to use a custom serializer plug-in:

  1. Add a {@link com.ibm.websphere.objectgrid.plugins.io.MapSerializerPlugin} plug-in to the backingMapPluginCollection in the ObjectGrid deployment XML file. The MapSerializer defines the KeyDataSerializer and ValueDataSerializer to use for a map, and also allows defining relationships between maps. The {@link com.ibm.websphere.objectgrid.plugins.io.BasicMapSerializerPlugin} can be used directly, or can be extended to add additional configuration options.
  2. Configure the BackingMap to use the COPY_TO_BYTES copy mode: copyMode="COPY_TO_BYTES"

ObjectGrid Deployment XML File Example

<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
    xmlns="http://ibm.com/ws/objectgrid/config">

    <objectGrids>
        <objectGrid name="BookstoreGrid" txTimeout="5">
            <backingMap
                name="Customer"
                pluginCollectionRef="plugin_Customer"
                copyMode="COPY_TO_BYTES"
            />
        </objectGrid>
    </objectGrids>

    <backingMapPluginCollections>
        <backingMapPluginCollection id="plugin_Customer">
            <bean id="MapSerializer"
                className="com.ibm.websphere.objectgrid.plugins.io.BasicMapSerializerPlugin">

                <property
                    name="keyDataSerializerClass"
                    type="java.lang.String"
                    value="com.ibm.websphere.samples.xs.serializer.proto.ProtoKeySerializer" />

                <property
                    name="keyProperties"
                    type="java.lang.String"
                    value="type=com.ibm.websphere.samples.xs.serializer.proto.DataObjects1$CustomerKey" />

                <property name="valueDataSerializerClass"
                    type="java.lang.String"
                    value="com.ibm.websphere.samples.xs.serializer.proto.ProtoValueSerializer" />

                <property name="valueProperties"
                    type="java.lang.String"
                    value="type=com.ibm.websphere.samples.xs.serializer.proto.DataObjects1$Customer" />
            </bean>
        </backingMapPluginCollection>
    </backingMapPluginCollections>
</objectGridConfig>