1 24 package org.objectweb.joram.mom.notifications; 25 26 import fr.dyade.aaa.agent.AgentId; 27 import org.objectweb.joram.shared.messages.Message; 28 29 import java.util.Vector ; 30 31 35 public class ClientMessages extends AbstractRequest { 36 37 private Message message = null; 38 39 private Vector messages = null; 40 41 private AgentId producerDMQId = null; 42 43 private boolean asyncSend; 44 45 51 public ClientMessages(int clientContext, int requestId) { 52 super(clientContext, requestId); 53 } 54 55 62 public ClientMessages(int clientContext, int requestId, Message message) { 63 super(clientContext, requestId); 64 this.message = message; 65 } 66 67 74 public ClientMessages(int clientContext, int requestId, Vector messages) { 75 super(clientContext, requestId); 76 if (messages.size() == 1) 77 message = (Message) messages.get(0); 78 else 79 this.messages = messages; 80 } 81 82 85 public ClientMessages() {} 86 87 88 89 public void addMessage(Message msg) { 90 if (message == null && messages == null) 91 message = msg; 92 else { 93 if (messages == null) { 94 messages = new Vector (); 95 messages.add(message); 96 message = null; 97 } 98 messages.add(msg); 99 } 100 } 101 102 103 public void setDMQId(AgentId dmqId) { 104 producerDMQId = dmqId; 105 } 106 107 108 109 public Vector getMessages() { 110 if (messages == null) { 111 messages = new Vector (); 112 if (message != null) 113 messages.add(message); 114 } 115 return messages; 116 } 117 118 public void setAsyncSend(boolean b) { 119 asyncSend = b; 120 } 121 122 public final boolean getAsyncSend() { 123 return asyncSend; 124 } 125 126 127 public AgentId getDMQId() { 128 return producerDMQId; 129 } 130 131 139 public StringBuffer toString(StringBuffer output) { 140 output.append('('); 141 super.toString(output); 142 output.append(",message=").append(message); 143 output.append(",messages=").append(messages); 144 output.append(",producerDMQId=").append(producerDMQId); 145 output.append(",asyncSend=").append(asyncSend); 146 output.append(')'); 147 148 return output; 149 } 150 } 151 | Popular Tags |