Program guide > Programming with system APIs and plug-ins
Introduction to plug-ins
A WebSphere eXtreme Scale plug-in is a component that provides a certain type of function to the pluggable components that include ObjectGrid and BackingMap. WebSphere eXtreme Scale provides several plug points to allow applications and cache providers to integrate with various data stores, alternative client APIs and to improve overall performance of the cache. The product ships with several default, prebuilt plug-ins, but you can also build custom plug-ins with the application.
All plug-ins are concrete classes that implement one or more eXtreme Scale plug-in interfaces. These classes are then instantiated and invoked by the ObjectGrid at appropriate times. The ObjectGrid and BackingMaps each allow custom plug-ins to be registered.
ObjectGrid plug-ins
The following plug-ins are available for an ObjectGrid instance. If the plug-in is server side only, the plug-ins are removed on the client ObjectGrid and BackingMap instances. The ObjectGrid and BackingMap instances are only on the server.
- TransactionCallback: A TransactionCallback plug-in provides transaction life cycle events. If the TransactionCallback plug-in is the built-in JPATxCallback (com.ibm.websphere.objectgrid.jpa.JPATxCallback) class implementation, then the plug-in is server side only. However, the subclasses of the JPATxCallback class are not server side only.
- ObjectGridEventListener: An ObjectGridEventListener plug-in provides ObjectGrid life cycle events for the ObjectGrid, shards, and transactions.
- SubjectSource, ObjectGridAuthorization, SubjectValidation: eXtreme Scale provides several security endpoints to allow custom authentication mechanisms to be integrated with eXtreme Scale. (Server side only)
- MapAuthorization: (Server side only)
Common ObjectGrid plug-in requirements
The ObjectGrid instantiates and initializes plug-in instances using JavaBeans™ conventions. All of the previous plug-in implementations have the following requirements:
- The plug-in class must be a top-level public class.
- The plug-in class must provide a public, no-argument constructor.
- The plug-in class must be available in the class path for both servers and clients (as appropriate).
- Attributes must be set using the JavaBeans style property methods.
- Plug-ins, unless specifically noted, are registered before ObjectGrid initializes and cannot be changed after the ObjectGrid is initialized.
BackMap plug-ins
The following plug-ins are available for a BackingMap:
- Evictor: An evictor plug-in is a default mechanism is provided for evicting cache entries and a plug-in for creating custom evictors.
- ObjectTransformer: An ObjectTransformer plug-in allows you to serialize, deserialize, and copy objects in the cache.
- OptimisticCallback: An OptimisticCallback plug-in allows you to customize versioning and comparison operations of cache objects when you are using the optimistic lock strategy.
- MapEventListener: A MapEventListener plug-in provides callback notifications and significant cache state changes that occur for a BackingMap.
- Indexing: Use the indexing feature, which is represented by the MapIndexplug-in plug-in, to build an index or several indexes on a BackingMap map to support non-key data access.
- Loader: A Loader plug-in on an ObjectGrid map acts as a memory cache for data that is typically kept in a persistent store on either the same system or some other system. (Server side only)
Plug-in life cycles
Most plug-ins have both initialize and destroy methods or equivalent methods, in addition to the methods for which they were designed to operate. These specialized methods of each plug-in are available to be invoked at designated functional points. Both initialize and destroy methods define the life cycle of plug-ins, which are controlled by their "owner" objects. An owner object is the object that actually uses the given plug-in. An owner can be a grid client, server, or a backing map.
When owner objects are initializing, they will invoke the initialize method of their owned plug-ins. During the destroy cycle of owner objects, the destroy method of plug-ins will be consequently invoked also. For details on the specifics of initialize and destroy methods, along with other methods capable with each plug-in, refer to the topics relevant to each plug-in.
As an example, consider a distributed environment. Both the client-side ObjectGrids and the server-side ObjectGrids can have their own plug-ins. The life cycle of a client-side ObjectGrid and, therefore, its plug-in instances are independent from all server-side ObjectGrid and plug-in instances.
In such a distributed topology, say you have an ObjectGrid named "myGrid" defined in the objectGrid.xml file and configured with a customized ObjectGridEventListener named myObjectGridEventListener. The objectGridDeployment.xml file defines the deployment policy for the myGrid ObjectGrid. Both the objectGrid.xml and objectGridDeployment.xml files are used to start container servers. During the startup of the container server, the server side myGrid ObjectGrid instance is initialized and the initialize method of the myObjectGridEventListener instance that is owned by the myObjectGrid instance is invoked. After the container server is started, the application can connect to the server-side myGrid ObjectGrid instance and obtain a client-side instance.
When obtaining the client-side myGrid ObjectGrid instance, the client-side myGrid instance goes through its own initialization cycle and invokes the initialize method of its own client-side myObjectGridEventListener instance. This client side myObjectGridEventListener instance is independent from the server-side myObjectGridEventListener instance. Its life cycle is controlled by its owner, which is the client-side myGrid ObjectGrid instance.
If the application disconnects or destroys the client-side myGrid ObjectGrid instance, the destroy method of the owned client-side myObjectGridEventListener instance are invoked automatically. However, this has no impact on server-side myObjectGridEventListener instance. The destroy method of the server-side myObjectGridEventListener instance is only be invoked during the destroy cycle of the server-side myGrid ObjectGrid instance when stopping a container server. That is, when stopping a container server, the contained ObjectGrid instances are destroyed and the destroy method of all their owned plug-ins is invoked.
Although the previous example applies specifically to the case of a client and a server instance of an ObjectGrid, the owner of a plug-in can also be a BackingMap and be careful to determine the configurations for plug-ins that you may write based on these life cycle considerations.
Parent topic:
Program with system APIs and plug-ins
Related concepts
Plug-ins for evicting cache objects
Plug-ins for transforming cached objects
Plug-ins for versioning and comparing cache objects
Plug-ins for custom indexing of cache objects
Plug-ins for communicating with persistent stores
Plug-ins for managing transaction life cycle events
Related reference
Plug-ins for providing event listeners