1 46 package org.mr.api.jms; 47 import java.io.IOException ; 48 import java.io.Serializable ; 49 50 import javax.jms.JMSException ; 51 import javax.jms.Queue ; 52 53 import org.mr.core.util.byteable.Byteable; 54 import org.mr.core.util.byteable.ByteableInputStream; 55 import org.mr.core.util.byteable.ByteableOutputStream; 56 import org.mr.core.util.byteable.ByteableRegistry; 57 58 78 public class MantaQueue 79 extends MantaDestination 80 implements Byteable, Serializable , Queue { 81 82 86 public MantaQueue() { 87 this.destinationName = " "; 88 } 89 90 94 public MantaQueue(String name) { 95 this.destinationName = name; 96 } 98 99 public String toString() { 100 return this.destinationName; 101 } 103 106 public String getQueueName() { 107 return this.destinationName; 108 } 109 110 public static final String BYTEABLENAME = "MantaQueue"; 111 public String getByteableName() { 112 113 return BYTEABLENAME; 114 } 115 116 117 public void toBytes(ByteableOutputStream out) throws IOException { 118 119 out.writeUTF(this.destinationName); 120 121 } 122 123 public Byteable createInstance(ByteableInputStream in) throws IOException { 124 125 MantaQueue cq = new MantaQueue(); 126 cq.destinationName = in.readUTF(); 127 return cq; 128 } 129 130 public void registerToByteableRegistry() { 131 ByteableRegistry.registerByteableFactory(getByteableName() , this); 132 133 } 134 135 public static void register() throws JMSException { 136 MantaQueue instance = new MantaQueue(); 137 instance.registerToByteableRegistry(); 138 } 139 140 141 } | Popular Tags |