KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Represents a partial command; a large command that has been split up into
24  * pieces.
25  *
26  * @openwire:marshaller code="60"
27  * @version $Revision: 426366 $
28  */

29 public class PartialCommand implements Command {
30
31     public static final byte DATA_STRUCTURE_TYPE = CommandTypes.PARTIAL_COMMAND;
32
33     private int commandId;
34     private byte[] data;
35
36     private transient Endpoint from;
37     private transient Endpoint to;
38
39     public PartialCommand() {
40     }
41
42     public byte getDataStructureType() {
43         return DATA_STRUCTURE_TYPE;
44     }
45
46     /**
47      * @openwire:property version=1
48      */

49     public int getCommandId() {
50         return commandId;
51     }
52
53     public void setCommandId(int commandId) {
54         this.commandId = commandId;
55     }
56
57     /**
58      * The data for this part of the command
59      *
60      * @openwire:property version=1 mandatory=true
61      */

62     public byte[] getData() {
63         return data;
64     }
65
66     public void setData(byte[] data) {
67         this.data = data;
68     }
69
70     public Endpoint getFrom() {
71         return from;
72     }
73
74     public void setFrom(Endpoint from) {
75         this.from = from;
76     }
77
78     public Endpoint getTo() {
79         return to;
80     }
81
82     public void setTo(Endpoint to) {
83         this.to = to;
84     }
85
86     public Response visit(CommandVisitor visitor) throws Exception JavaDoc {
87         throw new IllegalStateException JavaDoc("The transport layer should filter out PartialCommand instances but received: " + this);
88     }
89
90     public boolean isResponseRequired() {
91         return false;
92     }
93
94     public boolean isResponse() {
95         return false;
96     }
97
98     public boolean isBrokerInfo() {
99         return false;
100     }
101
102     public boolean isMessageDispatch() {
103         return false;
104     }
105
106     public boolean isMessage() {
107         return false;
108     }
109
110     public boolean isMessageAck() {
111         return false;
112     }
113
114     public boolean isMessageDispatchNotification() {
115         return false;
116     }
117
118     public boolean isShutdownInfo() {
119         return false;
120     }
121
122     public void setResponseRequired(boolean responseRequired) {
123     }
124
125     public boolean isWireFormatInfo() {
126         return false;
127     }
128
129     public boolean isMarshallAware() {
130         return false;
131     }
132
133     public String JavaDoc toString() {
134         int size = 0;
135         if (data != null) {
136             size = data.length;
137         }
138         return "PartialCommand[id: " + commandId + " data: " + size + " byte(s)]";
139     }
140     
141     
142 }
143
Popular Tags