001    /*
002     * Copyright (C) The Apache Software Foundation. All rights reserved.
003     *
004     * This software is published under the terms of the Apache Software License
005     * version 1.1, a copy of which has been included with this distribution in
006     * the LICENSE file.
007     * 
008     * $Id: XACapable.java 155459 2005-02-26 13:24:44Z dirkv $
009     */
010    package org.apache.commons.messenger;
011    
012    import javax.transaction.Transaction;
013    
014    /** 
015     * <p><code>XACapable</code> is an object (typically a MessageListener in this context)
016     * which can be part of an XA transaction.
017     * This just means that this object has a way of providing XA resources.</p>
018     *
019     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
020     * @version $Revision: 155459 $
021     */
022    public interface XACapable {
023    
024            /**
025             * This method is called to enlist any XA resources the given object 
026             * has to be part of the XA transaction.
027             * 
028             * @param transaction the transaction to enlist to 
029             */     
030            public void enlistResources(Transaction transaction) throws Exception;
031    
032            /**
033             * This method is called to delist any XA resources the given object 
034             * has previously enlisted to this XA transaction.
035             * 
036             * @param transaction the transaction to delist resources from
037             * @param flag is the flag used by JTA when delisting resources.
038             * It is either XAResource.TMSUCCESS, XAResource.TMSUSPEND, or XAResource.TMFAIL
039             */     
040            public void delistResources(Transaction transaction, int flag) throws Exception;
041    }
042