View Javadoc

1   /*** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  
19  package org.codehaus.activemq.message;
20  
21  /***
22   * Provides a infomation about a Transaction
23   *
24   * @version $Revision: 1.5 $
25   */
26  public class TransactionInfo extends AbstractPacket implements TransactionType {
27  
28  
29      private int type;
30      private String transactionId;
31  
32      /***
33       * @return Returns the transactionId.
34       */
35      public String getTransactionId() {
36          return transactionId;
37      }
38  
39      /***
40       * @param transactionId The transactionId to set.
41       */
42      public void setTransactionId(String transactionId) {
43          this.transactionId = transactionId;
44      }
45  
46      /***
47       * Return the type of Packet
48       *
49       * @return integer representation of the type of Packet
50       */
51  
52      public int getPacketType() {
53          return TRANSACTION_INFO;
54      }
55  
56  
57      /***
58       * Test for equality
59       *
60       * @param obj object to test
61       * @return true if equivalent
62       */
63      public boolean equals(Object obj) {
64          boolean result = false;
65          if (obj != null && obj instanceof TransactionInfo) {
66              TransactionInfo info = (TransactionInfo) obj;
67              result = this.transactionId == info.transactionId;
68          }
69          return result;
70      }
71  
72      /***
73       * @return hash code for instance
74       */
75      public int hashCode() {
76          return this.transactionId != null ? this.transactionId.hashCode() : super.hashCode();
77      }
78  
79      /***
80       * @return Returns the type of transacton command.
81       */
82      public int getType() {
83          return this.type;
84      }
85  
86      /***
87       * @param newType the type of transaction command The type to set.
88       */
89      public void setType(int newType) {
90          this.type = newType;
91      }
92  
93  }