Package org.hibernate.osgi
Class OsgiJtaPlatform
- java.lang.Object
-
- org.hibernate.osgi.OsgiJtaPlatform
-
- All Implemented Interfaces:
java.io.Serializable
,JtaPlatform
,Service
public class OsgiJtaPlatform extends java.lang.Object implements JtaPlatform
Offers the JTA Platform provided by the OSGi container. The Enterprise OSGi spec requires all containers to register UserTransaction and TransactionManager OSGi services.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OsgiJtaPlatform(OsgiServiceUtil osgiServiceUtil)
Constructs a OsgiJtaPlatform
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRegisterSynchronization()
Can we currently register aSynchronization
?int
getCurrentStatus()
Obtain the current transaction status using whatever means is preferred for this platformjava.lang.Object
getTransactionIdentifier(Transaction transaction)
Determine an identifier for the given transaction appropriate for use in caching/lookup usages.void
registerSynchronization(Synchronization synchronization)
Register a JTASynchronization
in the means defined by the platform.TransactionManager
retrieveTransactionManager()
Locate theTransactionManager
UserTransaction
retrieveUserTransaction()
Locate theUserTransaction
-
-
-
Constructor Detail
-
OsgiJtaPlatform
public OsgiJtaPlatform(OsgiServiceUtil osgiServiceUtil)
Constructs a OsgiJtaPlatform- Parameters:
bundleContext
- The OSGi bundle context
-
-
Method Detail
-
retrieveTransactionManager
public TransactionManager retrieveTransactionManager()
Description copied from interface:JtaPlatform
Locate theTransactionManager
- Specified by:
retrieveTransactionManager
in interfaceJtaPlatform
- Returns:
- The
TransactionManager
-
retrieveUserTransaction
public UserTransaction retrieveUserTransaction()
Description copied from interface:JtaPlatform
Locate theUserTransaction
- Specified by:
retrieveUserTransaction
in interfaceJtaPlatform
- Returns:
- The
UserTransaction
-
getTransactionIdentifier
public java.lang.Object getTransactionIdentifier(Transaction transaction)
Description copied from interface:JtaPlatform
Determine an identifier for the given transaction appropriate for use in caching/lookup usages. Generally speaking the transaction itself will be returned here. This method was added specifically for use in WebSphere and other unfriendly Java EE containers.- Specified by:
getTransactionIdentifier
in interfaceJtaPlatform
- Parameters:
transaction
- The transaction to be identified.- Returns:
- An appropriate identifier
-
canRegisterSynchronization
public boolean canRegisterSynchronization()
Description copied from interface:JtaPlatform
Can we currently register aSynchronization
?- Specified by:
canRegisterSynchronization
in interfaceJtaPlatform
- Returns:
- True if registering a
Synchronization
is currently allowed; false otherwise.
-
registerSynchronization
public void registerSynchronization(Synchronization synchronization)
Description copied from interface:JtaPlatform
Register a JTASynchronization
in the means defined by the platform.- Specified by:
registerSynchronization
in interfaceJtaPlatform
- Parameters:
synchronization
- The synchronization to register
-
getCurrentStatus
public int getCurrentStatus() throws SystemException
Description copied from interface:JtaPlatform
Obtain the current transaction status using whatever means is preferred for this platform- Specified by:
getCurrentStatus
in interfaceJtaPlatform
- Returns:
- The current status.
- Throws:
SystemException
- Indicates a problem access the underlying status
-
-