/* * JBoss, Home of Professional Open Source * Copyright 2009, Red Hat Middleware LLC, and individual contributors * as indicated by the @author tags. * See the copyright.txt in the distribution for a full listing * of individual contributors. * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the GNU Lesser General Public License, v. 2.1. * This program is distributed in the hope that it will be useful, but WITHOUT A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License, * v.2.1 along with this distribution; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * (C) 2009, * @author JBoss Inc. */ package com.arjuna.ats.internal.jta.transaction.arjunacore.jca; import javax.transaction.xa.XAException; import javax.transaction.xa.Xid; import com.arjuna.ats.arjuna.common.Uid; import org.jboss.tm.TransactionImportResult; /** * A TransactionImporter is used to manager the relationship with external SubordinateTransactions. */ public interface TransactionImporter { /** * Create a subordinate transaction associated with the global transaction * inflow. No timeout is associated with the transaction. * * @param xid * the global transaction. * * @return the subordinate transaction. * * @throws javax.transaction.xa.XAException * thrown if there are any errors. */ public SubordinateTransaction importTransaction(Xid xid) throws XAException; /** * Create a subordinate transaction associated with the global transaction * inflow and having a specified timeout. * * @param xid * the global transaction. * @param timeout * the timeout associated with the global transaction. * * @return the subordinate transaction. * * @throws javax.transaction.xa.XAException * thrown if there are any errors. */ public SubordinateTransaction importTransaction(Xid xid, int timeout) throws XAException; public TransactionImportResult importRemoteTransaction(Xid xid, int timeout) throws XAException; /** * Used to recover an imported transaction. * * @param actId * the state to recover. * @return the recovered transaction object. * @throws javax.transaction.xa.XAException */ public SubordinateTransaction recoverTransaction(Uid actId) throws XAException; /** * Get the subordinate (imported) transaction associated with the global * transaction. * * @param xid * the global transaction. * * @return the subordinate transaction or <code>null</code> if there is * none. * * @throws javax.transaction.xa.XAException * thrown if there are any errors. */ public SubordinateTransaction getImportedTransaction(Xid xid) throws XAException; /** * Remove the subordinate (imported) transaction. * * @param xid * the global transaction. * * @throws javax.transaction.xa.XAException * thrown if there are any errors. */ public void removeImportedTransaction(Xid xid) throws XAException; }