Spring Integration Implementation

  GigaSpaces 5.X

Documentation Home
Quick Start Guide
Release Notes

Previous release

  Search Here
Searching GigaSpaces Platform 5.X Documentation

                                               

Summary: Description of GigaSpaces Spring implementation classes: the factory bean; the Spring template; an extension of the JavaSpacesTemplate; and a local transaction factory bean.

Overview

The 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.

The following sections describe the GigaSpaces Spring implementation classes, which are part of the org.springmodules.javaspaces.gigaspaces package. The GigaSpaces Spring implementation classes are located in the <GigaSpaces Root>\lib\spring\springmodules-javaspaces.jar library.
Renamed in GigaSpaces 5.2
The springmodules-javaspaces.jar file above has been renamed to spring-modules-javaspaces.jar in GigaSpaces 5.2 and onwards.

GigaSpacesFactoryBean

An Entry point for GigaSpaces Spring support. This is a standard Spring factory bean. The following properties are injected:

Property Description
urls List of GigaSpaces space URLs. When the URL represents a remote URL, these are accessed one by one until a connection is established. When using an embedded space URL, a new space instance is started at the running application memory address.
listeners Notify templates allowing notifications when matching Entries are written to the space.
To ensure each client gets the relevant result object back from the worker, the task and result are injected with a unique UID generated on the client side.

The standard GigaSpacesFactoryBean.getObject() method creates or accesses an IJSpace object according to the URLs provided, used by the GigaSpacesTemplate, GigaSpacesDaoSupport, or GigaSpacesLocalTransactionManagerFactoryBean.

GigaSpacesDaoSupport

This 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.

For a complete documentation of the class's fields, methods and constructors, see Javadoc.

GigaSpacesTemplate

The 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.

For a complete documentation of the class's fields, methods and constructors, see Javadoc.

GigaSpacesLocalTransactionManagerFactoryBean

Extends 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:

  • RequiredNew
  • Never
  • Required
  • Mandatory
  • Supports
  • NotSupported
For more details on transactions, refer to:

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.

Labels