IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins.io
Class BasicMapSerializerPlugin

java.lang.Object
  extended by com.ibm.websphere.objectgrid.plugins.io.BasicMapSerializerPlugin
All Implemented Interfaces:
BackingMapPlugin, Destroyable, Initializable, MapSerializerPlugin

public class BasicMapSerializerPlugin
extends Object
implements MapSerializerPlugin

A basic implementation of a MapSerializerPlugin plug-in that can reference an arbitrary KeyDataSerializer and ValueDataSerializer.

Use the setKeySerializerPluginClass(String) and setValueSerializerPluginClass(String) properties to set the key and value data serializer type.

Use the setKeyProperties(String) and setValueProperties(String) properties to set one or more string attributes on the target key or value DataSerializer.

Use the setAssociations(String) property to describe any associations between the map in which this MapSerializer references and other maps. Use the setAddressableKeyName(String) property to identify the addressable attribute name to use for accessing KeyDataSerializer data when using partial key lookups.

Since:
7.1.1

Constructor Summary
BasicMapSerializerPlugin()
          Default constructor.
BasicMapSerializerPlugin(KeySerializerPlugin serKey, ValueSerializerPlugin serValue)
          Constructor that sets a KeySerializerPlugin and ValueSerializerPlugin.
 
Method Summary
 void destroy()
          Invoked when the bean's state has been set and is ready to be destroyed.
 String getAddressableKeyName()
          Retrieve the addressable attribute name for the KeyDataSerializer for this MapSerializer
 String getAssociations()
          Retrieve the associations for this MapSerializer.
 BackingMap getBackingMap()
          Retrieve the BackingMap instance associated with this plug-in.
 String getKeyProperties()
          Retrieve the String property from the KeyDataSerializer.
 KeySerializerPlugin getKeySerializerPlugin()
          The KeySerializer to use for all key entries in the map.
 String getKeySerializerPluginClass()
          Retrieves the name of the KeySerializerPlugin class that was set with the setKeySerializerPluginClass(String) method.
 MapDataDescriptor getMapDataDescriptor()
          The MapDataDescriptor that describes the map.
 String getValueProperties()
          Retrieve the String property from the ValueDataSerializer.
 ValueSerializerPlugin getValueSerializerPlugin()
          The ValueSerializer to use for all value entries in the map.
 void initialize()
          Perform initialization of the map serializer, including but not limited to the following steps.
 boolean isDestroyed()
          Answers true if the bean is in the destroyed state, false otherwise.
 boolean isInitialized()
          Answers true if the bean is in the initialized state, false otherwise.
 void setAddressableKeyName(String addressableKeyName)
          Set the addressableKeyName property for the MapDataDescriptor used by this MapSerializer.
 void setAssociations(String mapAssociations)
          Associations are a set of comma-delimited properties that identify relationships from object attributes in map entries in the BackingMap associated with this MapSerializer (the source map) to map entries in another map (the target map).
 void setBackingMap(BackingMap map)
          The BackingMap instance is at an undefined state, depending on the type of plug-in and how it was registered with the map.
 void setKeyProperties(String property)
          Set the String property on the KeyDataSerializer.
 void setKeySerializerPlugin(KeySerializerPlugin keySerializerPlugin)
          Used to programmatically set the KeySerializerPlugin for local ObjectGrid instances.
 void setKeySerializerPluginClass(String serClass)
          Sets the name of the KeySerializerPlugin class.
 void setValueProperties(String properties)
          Set the String properties on the ValueDataSerializer.
 void setValueSerializerPlugin(ValueSerializerPlugin valueSerializerPlugin)
          Retrieves the name of the ValueDataSerializer class that was set with the setValueSerializerPluginClass(String).
 void setValueSerializerPluginClass(String serClass)
          Sets the name of the ValueSerializerPlugin class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMapSerializerPlugin

public BasicMapSerializerPlugin()
Default constructor.


BasicMapSerializerPlugin

public BasicMapSerializerPlugin(KeySerializerPlugin serKey,
                                ValueSerializerPlugin serValue)
Constructor that sets a KeySerializerPlugin and ValueSerializerPlugin.

Parameters:
serKey - the KeySerializerPlugin or null if not defined.
serValue - the ValueSerializerPlugin or null if not defined.
Method Detail

setKeyProperties

public void setKeyProperties(String property)
Set the String property on the KeyDataSerializer. The property is in the format:
propertyName=value[,propertyName=value]
. Embedded commas can be specified in the property values by escaping the comma with a back-slash. Additionally, the "\," can be escaped using one additional "\" characters, allowing a terminal "\" on the value. For example:
embeddedCommas=val1\,val2\,val3,trailingBackSlash=val4\\,name3=val5
. The properties are not flushed to the ValueDataSerializeer until it is initialized. After that time, the properties cannot be set.

Parameters:
property - a non-null, comma delimited set of name/value pairs to set on the KeyDataSerializer

getKeyProperties

public String getKeyProperties()
Retrieve the String property from the KeyDataSerializer.

Returns:
the properties set with the setKeyProperties method.

setValueProperties

public void setValueProperties(String properties)
Set the String properties on the ValueDataSerializer. The property is in the format:
propertyName=value[,propertyName=value]
. Embedded commas can be specified in the property values by escaping the comma with a back-slash. Additionally, the "\," can be escaped using one additional "\" characters, allowing a terminal "\" on the value. For example:
embeddedCommas=val1\,val2\,val3,trailingBackSlash=val4\\,name3=val5
. The properties are not flushed to the ValueDataSerializeer until it is initialized. After that time, the properties cannot be set.

Parameters:
properties - a non-null, comma delimited set of name/value pairs to set on the ValueDataSerializer

getValueProperties

public String getValueProperties()
Retrieve the String property from the ValueDataSerializer.

Returns:
the properties set with the setValueProperties method.

getMapDataDescriptor

public MapDataDescriptor getMapDataDescriptor()
Description copied from interface: MapSerializerPlugin
The MapDataDescriptor that describes the map.

Specified by:
getMapDataDescriptor in interface MapSerializerPlugin
Returns:
the MapDataDescriptor
See Also:
MapSerializerPlugin.getMapDataDescriptor()

getKeySerializerPlugin

public KeySerializerPlugin getKeySerializerPlugin()
Description copied from interface: MapSerializerPlugin
The KeySerializer to use for all key entries in the map.

Specified by:
getKeySerializerPlugin in interface MapSerializerPlugin
Returns:
the KeySerializer or null if none.
See Also:
MapSerializerPlugin.getKeySerializerPlugin()

setKeySerializerPlugin

public void setKeySerializerPlugin(KeySerializerPlugin keySerializerPlugin)
Used to programmatically set the KeySerializerPlugin for local ObjectGrid instances.

Parameters:
keySerializerPlugin - the KeySerializerPlugin instance.

setKeySerializerPluginClass

public void setKeySerializerPluginClass(String serClass)
Sets the name of the KeySerializerPlugin class.

Parameters:
serClass - the name of the KeySerializerPlugin class.

getKeySerializerPluginClass

public String getKeySerializerPluginClass()
Retrieves the name of the KeySerializerPlugin class that was set with the setKeySerializerPluginClass(String) method.

Returns:
the name of the KeySerializerPlugin class

setValueSerializerPluginClass

public void setValueSerializerPluginClass(String serClass)
Sets the name of the ValueSerializerPlugin class.

Parameters:
serClass - the name of the ValueSerializerPlugin class.

getValueSerializerPlugin

public ValueSerializerPlugin getValueSerializerPlugin()
Description copied from interface: MapSerializerPlugin
The ValueSerializer to use for all value entries in the map.

Specified by:
getValueSerializerPlugin in interface MapSerializerPlugin
Returns:
the ValueSerializer or null if none.
See Also:
MapSerializerPlugin.getValueSerializerPlugin()

setValueSerializerPlugin

public void setValueSerializerPlugin(ValueSerializerPlugin valueSerializerPlugin)
Retrieves the name of the ValueDataSerializer class that was set with the setValueSerializerPluginClass(String).

Parameters:
valueSerializerPlugin - the ValueSerializerPlugin instance.

setAssociations

public void setAssociations(String mapAssociations)
Associations are a set of comma-delimited properties that identify relationships from object attributes in map entries in the BackingMap associated with this MapSerializer (the source map) to map entries in another map (the target map).

I.e. The object attributes hold key values for entries in another map.

Each property is defined as follows:

Property NameDescription
attributeThe name or path to the source attribute that holds the target map entry's key (the foreign key). If the attribute is an attribute on a key object, it must be prefixed by the addressable key name and the path separator (by default "key."). If the attribute is stored inside other embedded attributes, then attribute name must include the entire path to the key, using the DataSerializer's path separator.
targetMapThe name of the associated map which contains the target map entry

For example, consider the MapSerializerPlugin associated with the ParentMap, which has a one-to-many bi-directional relationship to the ChildMap and a uni-directional one-to-one relationship with the AddressMap map.

The relationships might be defined as follows:

ParentMap: "targetMap=ChildMap,attribute=childrenKeys,inverseAttribute=parentKey"

ChildMap: "targetMap=ParentMap,attribute=parentKey,inverseAttribute=childrenKeys" The foreign key to the ChildMap may be stored in an embedded attribute:

ParentMap: "targetMap=ChildMap,attribute=embeddedType/childrenKeys"

Parameters:
mapAssociations - the list of map associations.

getAssociations

public String getAssociations()
Retrieve the associations for this MapSerializer.

Returns:
the list of map associations.
See Also:
setAssociations(String)

setAddressableKeyName

public void setAddressableKeyName(String addressableKeyName)
Set the addressableKeyName property for the MapDataDescriptor used by this MapSerializer. The addressableKeyName property allows you to change the default name that is used when navigating to key fields in a query or index. The default addressibleKeyName is: "key".

For example, suppose that a key in your map contains two fields named x and y. If you only want to query field x, then the query might look like : "select c.key.x from Customer c"
If you change the addressableKeyName to "myKey", then the above query must be re-written as "select c.myKey.x from Customer c"

Parameters:
addressableKeyName - the addressable attribute name to use for accessing KeyDataSerializer data when navigating to key attributes in queries and indexes.
Since:
8.5

getAddressableKeyName

public String getAddressableKeyName()
Retrieve the addressable attribute name for the KeyDataSerializer for this MapSerializer

Returns:
the addressable attribute name to use for accessing KeyDataSerializer data when navigating to key attributes in queries and indexes.
See Also:
setAddressableKeyName(String)

destroy

public void destroy()
Description copied from interface: Destroyable
Invoked when the bean's state has been set and is ready to be destroyed. The result should be that the bean is in the destroyed state.

Specified by:
destroy in interface Destroyable
See Also:
Destroyable.destroy()

isDestroyed

public boolean isDestroyed()
Description copied from interface: Destroyable
Answers true if the bean is in the destroyed state, false otherwise.

During normal operation, this method may be called to confirm the correct operation of the Destroyable.destroy() method.

Specified by:
isDestroyed in interface Destroyable
Returns:
true if the bean is in the destroyed state.
See Also:
Destroyable.isDestroyed()

initialize

public void initialize()
                throws ObjectGridRuntimeException
Perform initialization of the map serializer, including but not limited to the following steps.

Specified by:
initialize in interface Initializable
Throws:
ObjectGridRuntimeException
See Also:
Initializable.initialize()

isInitialized

public boolean isInitialized()
Description copied from interface: Initializable
Answers true if the bean is in the initialized state, false otherwise.

During normal operation, this method may be called to confirm the correct operation of the Initializable.initialize() method.

Specified by:
isInitialized in interface Initializable
Returns:
true if the bean is in the initialized state.
See Also:
Initializable.isInitialized()

setBackingMap

public void setBackingMap(BackingMap map)
Description copied from interface: BackingMapPlugin
The BackingMap instance is at an undefined state, depending on the type of plug-in and how it was registered with the map. Use the BackingMap.getState() method to determine what state the map is in.

Specified by:
setBackingMap in interface BackingMapPlugin
Parameters:
map - the BackingMap associated with this plug-in instance.
See Also:
BackingMapPlugin.setBackingMap(com.ibm.websphere.objectgrid.BackingMap)

getBackingMap

public BackingMap getBackingMap()
Description copied from interface: BackingMapPlugin
Retrieve the BackingMap instance associated with this plug-in.

During normal operation, this method may be called to confirm the correct operation of the BackingMapPlugin. It must return the BackingMap instance previously set using the BackingMapPlugin.setBackingMap(BackingMap) method.

Specified by:
getBackingMap in interface BackingMapPlugin
Returns:
the BackingMap instance.
See Also:
BackingMapPlugin.getBackingMap()

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.