IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.spring
Class ObjectGridSpringFactory

java.lang.Object
  extended by com.ibm.websphere.objectgrid.spring.ObjectGridSpringFactory

public final class ObjectGridSpringFactory
extends Object

This class serves as a factory to construct instances of the various Spring specific APIs.

Since:
WAS XD 6.1 FIX3, XC10

Field Summary
static String SCOPE_SHARD
          Scope identifier for shard scope: "shard".
 
Constructor Summary
ObjectGridSpringFactory()
           
 
Method Summary
static BeanFactory getBeanFactoryForObjectGrid(String objectGridName)
          This returns the currently registered external bean factory for a named object grid.
static Object getBeanInShardScope(ObjectGrid shard, String beanName)
          This returns an instance of the named Spring bean with the current shard scope using the specified ObjectGrid instance.
static SpringLocalTxManager getLocalPlatformTransactionManager()
          This returns an ObjectGrid PlatformLocalTransactionManager.
static void registerSpringBeanFactoryAdapter(String objectGridName, Object springBeanFactory)
          This returns an adapter for a Spring based bean factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_SHARD

public static final String SCOPE_SHARD
Scope identifier for shard scope: "shard".

See Also:
getBeanInShardScope(ObjectGrid, String), Constant Field Values
Constructor Detail

ObjectGridSpringFactory

public ObjectGridSpringFactory()
Method Detail

getLocalPlatformTransactionManager

public static SpringLocalTxManager getLocalPlatformTransactionManager()
This returns an ObjectGrid PlatformLocalTransactionManager.

Returns:
the PlatformLocalTransactionManager instance.

registerSpringBeanFactoryAdapter

public static void registerSpringBeanFactoryAdapter(String objectGridName,
                                                    Object springBeanFactory)
                                             throws ClassCastException
This returns an adapter for a Spring based bean factory. We use an Object type here to avoid making ObjectGrid dependent on Spring classes being present. A ClassCastException exception is thrown if the supplied factory isn't a Spring BeanFactory instance.

Parameters:
objectGridName - the name of the ObjectGrid
springBeanFactory - A Spring BeanFactory instance.
Throws:
ClassCastException - thrown when the Object type is not a BeanFactory instance.

getBeanFactoryForObjectGrid

public static BeanFactory getBeanFactoryForObjectGrid(String objectGridName)
This returns the currently registered external bean factory for a named object grid. If no factory has been registered then it attempts to construct a Spring BeanFactory using the xml resource on the class path @ "/X_spring.xml" and /META-INF/X_spring.xml where X is the name of the ObjectGrid. If the xml file is on the class path then the ObjectGrid name MUST be a valid resource name.

Parameters:
objectGridName - The name of the ObjectGrid
Returns:
The BeanFactory instance or null if there were none registered

getBeanInShardScope

public static Object getBeanInShardScope(ObjectGrid shard,
                                         String beanName)
This returns an instance of the named Spring bean with the current shard scope using the specified ObjectGrid instance. This allows shard scoped beans to be obtained.

Parameters:
shard - The ObjectGrid instance to use to scope Spring beans using "shard" as scope.
beanName - The bean to return
Returns:
The bean instance if it exists
See Also:
SCOPE_SHARD

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

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