|
Summary: Description of GigaSpaces Spring implementation classes: the factory bean; the Spring template; an extension of the JavaSpacesTemplate; and a local transaction factory bean.
OverviewThe architecture of the GigaSpaces integration with Spring is very similar to the Hibernate Spring implementation. It is based on the Spring standards, including dependency injection, transaction attributes sources, configurable proxies/exports for remote services, and so on. Basic support for accessing a space is provided via a GigaSpacesFactoryBean which is configured in Spring's XML definition file. Configuration primarily includes a String array of space URLs. The factory creates a singleton space proxy, or runs an embedded space when an embedded space URL is used. The factory extends AbstractJavaSpaceFactoryBean which has the createSpace() template method, and adds a listener implementation if specified.
GigaSpacesFactoryBeanAn Entry point for GigaSpaces Spring support. This is a standard Spring factory bean. The following properties are injected:
The standard GigaSpacesFactoryBean.getObject() method creates or accesses an IJSpace object according to the URLs provided, used by the GigaSpacesTemplate, GigaSpacesDaoSupport, or GigaSpacesLocalTransactionManagerFactoryBean. GigaSpacesDaoSupportThis class is an implementation of the Spring template concept for JavaSpaces. It translates exceptions into the Spring exception hierarchy, and simplifies the performance of several operations in a single method.
GigaSpacesTemplateThe GigaSpacesTemplate extends the JavaSpaceTemplate to provide application developers a collection of helper methods for accessing the space, while wrapping specific checked exceptions thrown due to space operations with Spring's generic runtime exceptions. The template also exposes one general-purpose method, which accepts a JavaSpaceCallback object from the client application. This callback is where application logic code may be implemented, directly working with the space. The callback mechanism allows exception conversion to take place even when writing low-level code. The GigaSpacesTemplate methods accept not only objects implementing the Entry interface (as defined by JavaSpaces specification) but also POJOs (any object which has a void constructor and exposes meaningful data members via accessor/mutator methods). The template object exposes a general purpose method, execute(), which accepts a JavaSpaceCallback object, where application logic is implemented. The method invokes the callback object, wrapping the applicative logic with an exception conversion mechanism.
GigaSpacesLocalTransactionManagerFactoryBeanExtends the AbstractTransactionManagerFactoryBean class (org.springframework.transaction.jini.AbstractTransactionManagerFactoryBean; see Javadoc) defined in Spring, which integrates with Spring's existing transaction management mechanism. The class implements the template method createTransactionManager(), which creates the local transaction manager using the GigaSpaces LocalTransactionManager. The GigaSpaces Spring Transaction is responsible for creating, starting, suspending, resuming, committing and rolling back transactions which encompass space resources. The Transaction Manager is injected into Spring's generic Transaction Interceptor, which intercepts calls to services available in the application context using a proxy, and maintains transactional contexts for these calls based on configuration details (including propagation, isolation, etc). These configuration details can be defined as configuration data in the bean descriptor XML file using Java 5 annotations in the code, or any other valid implementation of Spring's TransactionAttributeSource interface. The following transaction propagation behaviors are supported:
|
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.
Add Comment