KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tm > XidFactoryBase


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.tm;
23
24 /**
25  * Created by IntelliJ IDEA.
26  * User: wburke
27  * Date: May 3, 2005
28  * Time: 2:48:26 PM
29  * To change this template use File | Settings | File Templates.
30  */

31 public interface XidFactoryBase
32 {
33    /**
34     * mbean get-set pair for field BaseGlobalId Get the value of BaseGlobalId
35     * @return value of BaseGlobalId
36     */

37    String JavaDoc getBaseGlobalId() ;
38
39    /**
40     * Set the value of BaseGlobalId
41     * @param BaseGlobalId Value to assign to BaseGlobalId
42     */

43    void setBaseGlobalId(String JavaDoc baseGlobalId) ;
44
45    /**
46     * mbean get-set pair for field globalIdNumber Get the value of globalIdNumber
47     * @return value of globalIdNumber
48     */

49    long getGlobalIdNumber() ;
50
51    /**
52     * Set the value of globalIdNumber
53     * @param globalIdNumber Value to assign to globalIdNumber
54     */

55    void setGlobalIdNumber(long globalIdNumber) ;
56
57    /**
58     * mbean get-set pair for field branchQualifier
59     * Get the value of BranchQualifier
60     * @return value of BranchQualifier
61     */

62    String JavaDoc getBranchQualifier() ;
63
64    /**
65     * Set the value of BranchQualifier
66     * @param branchQualifier Value to assign to BranchQualifier
67     */

68    void setBranchQualifier(String JavaDoc branchQualifier) ;
69
70    /**
71     * mbean get-set pair for field pad Get the value of pad
72     * @return value of pad
73     */

74    boolean isPad() ;
75
76    /**
77     * Set the value of pad
78     * @param pad Value to assign to pad
79     */

80    void setPad(boolean pad) ;
81
82    /**
83     * Creates a <code>XidImpl</code> for a new transaction.
84     * @return a <code>XidImpl</code> value
85     */

86    XidImpl newXid() ;
87
88    /**
89     * Creates a <code>XidImpl</code> for a branch of an existing transaction.
90     * @param globalId the code>GlobalId</code> of the existing transaction
91     * @return a <code>XidImpl</code> tor the new transaction branch.
92    */

93    XidImpl newBranch(GlobalId globalId);
94
95    /**
96     * Creates a <code>XidImpl</code> for a "fake branch" of an existing
97     * transaction. This method exists for a single reason: some
98     * <code>XAResource</code> implementations return false on all calls to
99     * <code>isSameRM</code>. If <code>isSameRM</code> worked properly, then
100     * there would be no need to generate a "fake branch" Xid for each
101     * <code>XAResource</code> that may or may not represent a new RM. A same
102     * <code>Xid</code> (the real <code>Xid</code> for the transaction branch)
103     * could (and should) be used for all <code>XAResource</code>s that
104     * represent different RMs. If <code>isSameRM</code> may return false
105     * negatives, however, the real branch Xid may be passed more than once
106     * to a same RM in calls to <code>XAResource.start</code>. This would result
107     * in <code>XAException</code>s with error code <code>XAER_DUPID</code>.
108     * We avoid this problem by generating a "fake branch" <code>Xid</code>
109     * for each <code>XAResource</code> that corresponds to a "new" RM according
110     * to <code>isSameRM</code>, but might actually not represent a new one.
111     *
112     * @param xid a <code>XidImpl</code> for the existing transaction
113     * @param branchNum a branch number to be included in the branch qualifier.
114     * @return a <code>XidImpl</code> for the new transaction branch.
115     */

116    XidImpl newBranch(XidImpl xid,long branchIdNum);
117    
118    XidImpl recreateXid(long localId);
119    
120    XidImpl recreateXid(long localId, GlobalId globalId);
121
122    /**
123     * Converts a local id into a global transaction id.
124     *
125     * @param localId the local transaction id
126     * @return the global transaction id
127     */

128    public byte[] localIdToGlobalId(long localId);
129    
130    /**
131     * Extracts the local id contained in a global id.
132     * @param globalId a global id
133     * @return the local id extracted from the global id
134     */

135    long extractLocalIdFrom(byte[] globalId) ;
136
137    String JavaDoc getBaseBranchQualifier(byte[] branchQualifier);
138    
139    /**
140     * Describe <code>toString</code> method here.
141     * @param xid a <code>Xid</code> value
142     * @return a <code>String</code> value
143     */

144    String JavaDoc toString(javax.transaction.xa.Xid JavaDoc xid) ;
145
146 }
147
Popular Tags