Top Description Fields Constructors Methods
org.springframework.jca.support

public Class SimpleBootstrapContext

extends Object
implements BootstrapContext
Class Inheritance
All Implemented Interfaces
jakarta.resource.spi.BootstrapContext
Imports
java.util.Timer, jakarta.resource.spi.BootstrapContext, .UnavailableException, .XATerminator, jakarta.resource.spi.work.WorkContext, .WorkManager, jakarta.transaction.TransactionSynchronizationRegistry, org.springframework.lang.Nullable, org.springframework.util.Assert

Simple implementation of the JCA 1.7 jakarta.resource.spi.BootstrapContext interface, used for bootstrapping a JCA ResourceAdapter in a local environment.

Delegates to the given WorkManager and XATerminator, if any. Creates simple local instances of java.util.Timer.

Author
Juergen Hoeller
Since
2.0.3
See Also
jakarta.resource.spi.ResourceAdapter#start(jakarta.resource.spi.BootstrapContext), ResourceAdapterFactoryBean

Field Summary

Modifier and TypeField and Description
private TransactionSynchronizationRegistry
private final WorkManager
private XATerminator

Constructor Summary

AccessConstructor and Description
public
SimpleBootstrapContext(WorkManager
the JCA WorkManager to use (may be null)
workManager
)

Create a new SimpleBootstrapContext for the given WorkManager, with no XATerminator available.

public
SimpleBootstrapContext(WorkManager
the JCA WorkManager to use (may be null)
workManager
,
XATerminator
the JCA XATerminator to use (may be null)
xaTerminator
)

Create a new SimpleBootstrapContext for the given WorkManager and XATerminator.

public
SimpleBootstrapContext(WorkManager
the JCA WorkManager to use (may be null)
workManager
,
XATerminator
the JCA XATerminator to use (may be null)
xaTerminator
,
TransactionSynchronizationRegistry
the TransactionSynchronizationRegistry to use (may be null)
transactionSynchronizationRegistry
)

Create a new SimpleBootstrapContext for the given WorkManager, XATerminator and TransactionSynchronizationRegistry.

Method Summary

Modifier and TypeMethod and Description
public Timer
createTimer()

Implements jakarta.resource.spi.BootstrapContext.createTimer.

Creates a new java.util.Timer instance.

public TransactionSynchronizationRegistry
getTransactionSynchronizationRegistry()

Implements jakarta.resource.spi.BootstrapContext.getTransactionSynchronizationRegistry.

Provides a handle to a TransactionSynchronization instance.

public WorkManager
getWorkManager()

Implements jakarta.resource.spi.BootstrapContext.getWorkManager.

Provides a handle to a WorkManager instance.

public XATerminator
getXATerminator()

Implements jakarta.resource.spi.BootstrapContext.getXATerminator.

Provides a handle to a XATerminator instance.

public boolean
isContextSupported(Class<? extends WorkContext>
The WorkContext type that is tested for support by the application server.
workContextClass
)

Implements jakarta.resource.spi.BootstrapContext.isContextSupported.

A resource adapter can check an application server's support for a particular WorkContext type through this method.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

transactionSynchronizationRegistryback to summary
private TransactionSynchronizationRegistry transactionSynchronizationRegistry
Annotations
@Nullable
workManagerback to summary
private final WorkManager workManager
Annotations
@Nullable
xaTerminatorback to summary
private XATerminator xaTerminator
Annotations
@Nullable

Constructor Detail

SimpleBootstrapContextback to summary
public SimpleBootstrapContext(WorkManager workManager)

Create a new SimpleBootstrapContext for the given WorkManager, with no XATerminator available.

Parameters
workManager:WorkManager

the JCA WorkManager to use (may be null)

SimpleBootstrapContextback to summary
public SimpleBootstrapContext(WorkManager workManager, XATerminator xaTerminator)

Create a new SimpleBootstrapContext for the given WorkManager and XATerminator.

Parameters
workManager:WorkManager

the JCA WorkManager to use (may be null)

xaTerminator:XATerminator

the JCA XATerminator to use (may be null)

SimpleBootstrapContextback to summary
public SimpleBootstrapContext(WorkManager workManager, XATerminator xaTerminator, TransactionSynchronizationRegistry transactionSynchronizationRegistry)

Create a new SimpleBootstrapContext for the given WorkManager, XATerminator and TransactionSynchronizationRegistry.

Parameters
workManager:WorkManager

the JCA WorkManager to use (may be null)

xaTerminator:XATerminator

the JCA XATerminator to use (may be null)

transactionSynchronizationRegistry:TransactionSynchronizationRegistry

the TransactionSynchronizationRegistry to use (may be null)

Since
5.0

Method Detail

createTimerback to summary
public Timer createTimer() throws UnavailableException

Implements jakarta.resource.spi.BootstrapContext.createTimer.

Doc from jakarta.resource.spi.BootstrapContext.createTimer.

Creates a new java.util.Timer instance. The Timer instance could be used to perform periodic Work executions or other tasks.

Returns:Timer

a new Timer instance.

Annotations
@Override
Exceptions
UnavailableException:
indicates that a Timer instance is not available. The request may be retried later.
getTransactionSynchronizationRegistryback to summary
public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry()

Implements jakarta.resource.spi.BootstrapContext.getTransactionSynchronizationRegistry.

Doc from jakarta.resource.spi.BootstrapContext.getTransactionSynchronizationRegistry.

Provides a handle to a TransactionSynchronization instance. The TransactionSynchronizationRegistry instance could be used by a resource adapter to register synchronization objects, get transaction state and status etc. This interface is implemented by the application server by a stateless service object. The same object can be used by any number of resource adapter objects with thread safety.

Returns:TransactionSynchronizationRegistry

a TransactionSynchronizationRegistry instance.

Annotations
@Override
@Nullable
getWorkManagerback to summary
public WorkManager getWorkManager()

Implements jakarta.resource.spi.BootstrapContext.getWorkManager.

Doc from jakarta.resource.spi.BootstrapContext.getWorkManager.

Provides a handle to a WorkManager instance. The WorkManager instance could be used by a resource adapter to do its work by submitting Work instances for execution.

Returns:WorkManager

a WorkManager instance.

Annotations
@Override
getXATerminatorback to summary
public XATerminator getXATerminator()

Implements jakarta.resource.spi.BootstrapContext.getXATerminator.

Doc from jakarta.resource.spi.BootstrapContext.getXATerminator.

Provides a handle to a XATerminator instance. The XATerminator instance could be used by a resource adapter to flow-in transaction completion and crash recovery calls from an EIS.

Returns:XATerminator

a XATerminator instance.

Annotations
@Override
@Nullable
isContextSupportedback to summary
public boolean isContextSupported(Class<? extends WorkContext> workContextClass)

Implements jakarta.resource.spi.BootstrapContext.isContextSupported.

Doc from jakarta.resource.spi.BootstrapContext.isContextSupported.

A resource adapter can check an application server's support for a particular WorkContext type through this method. This mechanism enables a resource adapter developer to dynamically change the WorkContexts submitted with a Work instance based on the support provided by the application server. The application server must employ an exact type equality check (that is java.lang.Class.equals(java.lang.Class) check) in this method, to check if it supports the WorkContext type provided by the resource adapter. This method must be idempotent, that is all calls to this method by a resource adapter for a particular WorkContext type must return the same boolean value throughout the lifecycle of that resource adapter instance.

Parameters
workContextClass:Class<? extends WorkContext>

The WorkContext type that is tested for support by the application server.

Returns:boolean

true if the workContextClass is supported by the application server. false if the workContextClass is unsupported or unknown to the application server.

Annotations
@Override