org.compass.spring.device
Class SpringSyncTransactionGpsDeviceWrapper
java.lang.Object
org.compass.gps.device.AbstractGpsDeviceWrapper
org.compass.spring.device.SpringSyncTransactionGpsDeviceWrapper
- All Implemented Interfaces:
- CompassGpsDevice, org.springframework.beans.factory.InitializingBean
public class SpringSyncTransactionGpsDeviceWrapper
- extends AbstractGpsDeviceWrapper
- implements org.springframework.beans.factory.InitializingBean
A Spring Transaction device wrapper, which starts a new transaction (with transaction propagation of
REQUIRES_NEW) for the device index operation.
When using SpringSyncTransactionFactory, this gps device wrapper should be used to wrap all
the devices within the application. Spring PlatformTransactionManager can either be
injected, or the device wrapper will try to get it from the configured LocalCompassBean
that is associated with the device CompassGps.
By default, setAllowNoTransactionManager(boolean) is set to true, so changing from
SpringSyncTransactionFactory to LocalTransactionFactory will not
require additional configuration changes. Changing it to false will mean that a transaction manager
must be accessible (either by setting the transcation manager, or associating one with the local compass bean).
- Author:
- kimchy
|
Method Summary |
void |
afterPropertiesSet()
|
void |
index(IndexPlan indexPlan)
If a Spring PlatformTransactionManager is available, will use it to execute the wrapped gps device
index operation within a new transcation with a propagation level of REQUIRES_NEW. |
void |
setAllowNoTransactionManager(boolean allowNoTransactionManager)
Should the device allows for cases where no Spring transaction manager is provided (for example, when
using Compass LocalTransactionFactory and not setting an transaction
manager. |
void |
setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
Sets the Spring PlatformTransactionManager that will be used to start a new transaction
for the index(org.compass.gps.IndexPlan) operation. |
void |
setTransactionTimeout(Integer transactionTimeout)
Sets the transaction timeout (see Spring DefaultTransactionDefinition.setTimeout(int). |
| Methods inherited from class org.compass.gps.device.AbstractGpsDeviceWrapper |
checkDeviceSet, getGps, getName, injectGps, isPerformingIndexOperation, isRunning, refresh, setGpsDevice, setName, shouldMirrorDataChanges, start, stop |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SpringSyncTransactionGpsDeviceWrapper
public SpringSyncTransactionGpsDeviceWrapper()
SpringSyncTransactionGpsDeviceWrapper
public SpringSyncTransactionGpsDeviceWrapper(CompassGpsDevice device)
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
- Throws:
Exception
index
public void index(IndexPlan indexPlan)
throws CompassGpsException
- If a Spring
PlatformTransactionManager is available, will use it to execute the wrapped gps device
index operation within a new transcation with a propagation level of REQUIRES_NEW.
- Specified by:
index in interface CompassGpsDevice- Overrides:
index in class AbstractGpsDeviceWrapper
- Throws:
CompassGpsException
setTransactionManager
public void setTransactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
- Sets the Spring
PlatformTransactionManager that will be used to start a new transaction
for the index(org.compass.gps.IndexPlan) operation. Note, this is an optioanl parameter, since if not set, Compass will
try and get Spring transaction manager from the associated LocalCompassBean.
setAllowNoTransactionManager
public void setAllowNoTransactionManager(boolean allowNoTransactionManager)
- Should the device allows for cases where no Spring transaction manager is provided (for example, when
using Compass
LocalTransactionFactory and not setting an transaction
manager. In such cases, no new transaction will be started.
Defaults to true.
setTransactionTimeout
public void setTransactionTimeout(Integer transactionTimeout)
- Sets the transaction timeout (see Spring
DefaultTransactionDefinition.setTimeout(int).
Copyright (c) 2004-2008 The Compass Project.