KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > command > ReplayCommand


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.command;
19
20 import org.apache.activemq.state.CommandVisitor;
21
22 /**
23  * A general purpose replay command for some kind of producer where ranges of
24  * messages are asked to be replayed. This command is typically used over a
25  * non-reliable transport such as UDP or multicast but could also be used on
26  * TCP/IP if a socket has been re-established.
27  *
28  * @openwire:marshaller code="65"
29  * @version $Revision: 426366 $
30  */

31 public class ReplayCommand extends BaseCommand {
32
33     public static final byte DATA_STRUCTURE_TYPE = CommandTypes.REPLAY;
34
35     private String JavaDoc producerId;
36     private int firstAckNumber;
37     private int lastAckNumber;
38     private int firstNakNumber;
39     private int lastNakNumber;
40
41     public ReplayCommand() {
42     }
43
44     public byte getDataStructureType() {
45         return DATA_STRUCTURE_TYPE;
46     }
47
48     public String JavaDoc getProducerId() {
49         return producerId;
50     }
51
52     /**
53      * Is used to uniquely identify the producer of the sequence
54      *
55      * @openwire:property version=1 cache=false
56      */

57     public void setProducerId(String JavaDoc producerId) {
58         this.producerId = producerId;
59     }
60
61     public int getFirstAckNumber() {
62         return firstAckNumber;
63     }
64
65     /**
66      * Is used to specify the first sequence number being acknowledged as delivered on the transport
67      * so that it can be removed from cache
68      *
69      * @openwire:property version=1
70      */

71     public void setFirstAckNumber(int firstSequenceNumber) {
72         this.firstAckNumber = firstSequenceNumber;
73     }
74
75     public int getLastAckNumber() {
76         return lastAckNumber;
77     }
78
79     /**
80      * Is used to specify the last sequence number being acknowledged as delivered on the transport
81      * so that it can be removed from cache
82      *
83      * @openwire:property version=1
84      */

85     public void setLastAckNumber(int lastSequenceNumber) {
86         this.lastAckNumber = lastSequenceNumber;
87     }
88
89     public Response visit(CommandVisitor visitor) throws Exception JavaDoc {
90         return null;
91     }
92
93     /**
94      * Is used to specify the first sequence number to be replayed
95      *
96      * @openwire:property version=1
97      */

98     public int getFirstNakNumber() {
99         return firstNakNumber;
100     }
101
102     public void setFirstNakNumber(int firstNakNumber) {
103         this.firstNakNumber = firstNakNumber;
104     }
105
106     /**
107      * Is used to specify the last sequence number to be replayed
108      *
109      * @openwire:property version=1
110      */

111     public int getLastNakNumber() {
112         return lastNakNumber;
113     }
114
115     public void setLastNakNumber(int lastNakNumber) {
116         this.lastNakNumber = lastNakNumber;
117     }
118
119     public String JavaDoc toString() {
120         return "ReplayCommand {commandId = " + getCommandId() + ", firstNakNumber = " + getFirstNakNumber() + ", lastNakNumber = " + getLastNakNumber() + "}";
121     }
122     
123 }
124
Popular Tags