1 22 package org.jboss.mq.il.uil2.msgs; 23 24 import java.io.ObjectOutputStream ; 25 import java.io.IOException ; 26 import java.io.ObjectInputStream ; 27 import javax.jms.Destination ; 28 import javax.jms.Topic ; 29 import javax.jms.Queue ; 30 31 35 public class CreateDestMsg extends BaseMsg 36 { 37 private String name; 38 private Destination dest; 39 40 public CreateDestMsg(boolean isQueue) 41 { 42 this(null, isQueue); 43 } 44 public CreateDestMsg(String name, boolean isQueue) 45 { 46 super(isQueue ? MsgTypes.m_createQueue : MsgTypes.m_createTopic); 47 this.name = name; 48 } 49 50 public String getName() 51 { 52 return name; 53 } 54 public Queue getQueue() 55 { 56 return (Queue ) dest; 57 } 58 public Topic getTopic() 59 { 60 return (Topic ) dest; 61 } 62 public void setDest(Destination dest) 63 { 64 this.dest = dest; 65 } 66 67 public void write(ObjectOutputStream out) throws IOException 68 { 69 super.write(out); 70 out.writeObject(name); 71 int hasDest = dest != null ? 1 : 0; 72 out.writeByte(hasDest); 73 if (hasDest == 1) 74 out.writeObject(dest); 75 } 76 public void read(ObjectInputStream in) throws IOException , ClassNotFoundException 77 { 78 super.read(in); 79 name = (String ) in.readObject(); 80 int hasDest = in.readByte(); 81 if (hasDest == 1) 82 dest = (Destination ) in.readObject(); 83 } 84 } 85 | Popular Tags |