Package org.beanlet.transaction

Adds support for JTA transaction.

See:
          Description

Interface Summary
TransactionContext Provides access to the transaction runtime context of the beanlet instance.
TransactionSynchronization Allows a beanlet instance to synchronize its state with the transactions performed on it.
 

Class Summary
TransactionManagerFactoryBeanlet Factory beanlet for a TransactionManager.
UserTransactionFactoryBeanlet Factory beanlet for a UserTransaction.
 

Enum Summary
TransactionAttributeType Defines all possible transaction types.
 

Annotation Types Summary
AfterBegin The AfterBegin method notifies a beanlet instance that a new transaction has started, and that the subsequent business methods on the instance will be invoked in the context of the transaction.
AfterCompletion The AfterCompletion method notifies a beanlet instance that the transaction commit protocol has completed, and tells the instance whether the transaction has been committed or rolled back.
BeforeCompletion The BeforeCompletion method notifies a beanlet instance that a transaction is about to be committed.
TransactionAttribute When applied at the TYPE-level, designates the default transaction attribute for all business methods of the beanlet.
 

Package org.beanlet.transaction Description

Adds support for JTA transaction.

Beanlet's transaction support requires a transaction manager to be available within the beanlet runtime. Being available to the runtime means that a beanlet must be registered for which the beanlet type matches the javax.transaction.TransactionManager interface. This allows the container to lookup the transaction manager by type. This approach of looking up a transaction manager also means that only one beanlet matching the javax.transaction.TransactionManager interface may exist to avoid ambiguity.

The following beanlet xml-file fragment shows how to integrate the JOTM transaction manager:

 <beanlets xmlns="http://beanlet.org/schema/beanlet"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://beanlet.org/schema/beanlet http://beanlet.org/schema/beanlet/beanlet_1_0.xsd">
   <beanlet name="org.objectweb.jotm.Jotm" 
            type="org.objectweb.jotm.Jotm">
     <inject constructor="true" index="0" value="true"/>
     <inject constructor="true" index="1" value="false"/>
     <pre-destroy method="stop"/>
   </beanlet>
   <beanlet type="javax.transaction.TransactionManager"
            factory="org.objectweb.jotm.Jotm" 
            factory-method="getTransactionManager"/>
   <beanlet type="javax.transaction.UserTransaction" 
            factory="org.objectweb.jotm.Jotm" 
            factory-method="getUserTransaction"/>
 </beanlets>
 

The JBoss transaction manager can also be installed, as is shown by the following snippet:

 <beanlets xmlns="http://beanlet.org/schema/beanlet"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://beanlet.org/schema/beanlet http://beanlet.org/schema/beanlet/beanlet_1_0.xsd">
   <beanlet type="javax.transaction.TransactionManager">
     <annotations type="com.arjuna.ats.jta.TransactionManager">
       <static-factory>
         <method name="transactionManager">
           <parameters/>
         </method>
       </static-factory>
     </annotations>
   </beanlet>
   <beanlet type="javax.transaction.UserTransaction">
     <annotations type="com.arjuna.ats.jta.UserTransaction">
       <static-factory>
         <method name="userTransaction">
           <parameters/>
         </method>
       </static-factory>
     </annotations>
   </beanlet>
 </beanlets>
 

Alternatively, beanlet can also integrate with a transaction manager that is available from JNDI. This is particularly useful if beanlet runs embedded within an EJB or Servlet container.

The following beanlet xml-file fragment shows how to integrate a transaction manager using the JNDI tree:

 <beanlets xmlns="http://beanlet.org/schema/beanlet"
           xmlns:jndi="http://beanlet.org/schema/naming"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://beanlet.org/schema/beanlet http://beanlet.org/schema/beanlet/beanlet_1_0.xsd
                               http://beanlet.org/schema/naming http://beanlet.org/schema/naming/beanlet_naming_1_0.xsd">
   <annotations>
     <jndi:naming-context/>
     <wiring value="BY_NAME"/>
   </annotations>
   <beanlet type="org.beanlet.transaction.TransactionManagerFactoryBeanlet">
     <inject constructor="true" name="java:comp/TransactionManager"/>
   </beanlet>
   <beanlet type="org.beanlet.transaction.UserTransactionFactoryBeanlet">
     <inject constructor="true" name="java:comp/UserTransaction"/>
   </beanlet>
 </beanlets>
 



Copyright © 2006-2012. All Rights Reserved.