KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > store > kahadaptor > TxCommand


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.apache.activemq.store.kahadaptor;
19
20 import org.apache.activemq.command.BaseCommand;
21 import org.apache.activemq.command.CommandTypes;
22
23
24 /**
25  * Base class for messages/acknowledgements for a transaction
26  *
27  * @version $Revision: 1.4 $
28  */

29 class TxCommand {
30         protected Object JavaDoc messageStoreKey;
31         protected BaseCommand command;
32
33         /**
34          * @return Returns the messageStoreKey.
35          */

36         public Object JavaDoc getMessageStoreKey(){
37             return messageStoreKey;
38         }
39
40         /**
41          * @param messageStoreKey The messageStoreKey to set.
42          */

43         public void setMessageStoreKey(Object JavaDoc messageStoreKey){
44             this.messageStoreKey=messageStoreKey;
45         }
46
47         /**
48          * @return Returns the command.
49          */

50         public BaseCommand getCommand(){
51             return command;
52         }
53
54         /**
55          * @param command The command to set.
56          */

57         public void setCommand(BaseCommand command){
58             this.command=command;
59         }
60         
61         /**
62          * @return true if a Message command
63          */

64         public boolean isAdd(){
65             return command != null && command.getDataStructureType() != CommandTypes.MESSAGE_ACK;
66         }
67         
68         /**
69          * @return true if a MessageAck command
70          */

71         public boolean isRemove(){
72             return command != null && command.getDataStructureType() == CommandTypes.MESSAGE_ACK;
73         }
74
75   
76     
77 }
78
Popular Tags