1 46 package org.mr.api.jms; 47 48 import javax.jms.Destination ; 49 import javax.jms.JMSException ; 50 import javax.jms.TemporaryTopic ; 51 52 import org.mr.core.util.byteable.Byteable; 53 import org.mr.core.util.byteable.ByteableInputStream; 54 import org.mr.core.util.byteable.ByteableRegistry; 55 56 import java.io.IOException ; 57 import java.io.Serializable ; 58 59 70 public class MantaTemporaryTopic extends MantaTopic implements Destination , Byteable, Serializable , TemporaryTopic { 71 72 private MantaConnection conn; 73 public MantaTemporaryTopic(String name, MantaConnection con) throws JMSException { 74 super(name); 75 conn=con; 76 } 78 79 86 public void delete() throws JMSException { 87 conn.deleteTempTopic(this.destinationName); 88 } 90 final static String objName = "MantaTempTopic"; 91 public String getByteableName() { 92 return objName; 93 } 94 95 public Byteable createInstance(ByteableInputStream in) throws IOException { 96 97 MantaTemporaryTopic tt; 98 try { 99 tt = new MantaTemporaryTopic(in.readUTF(),null); 100 } catch (JMSException e) { 101 throw new IOException ("Can't create topic: "+e.getMessage()); 102 } 103 return tt; 104 } 105 106 public void registerToByteableRegistry() { 107 ByteableRegistry.registerByteableFactory(getByteableName() , this); 108 } 109 110 public static void register() throws JMSException { 111 MantaTemporaryTopic instance = new MantaTemporaryTopic("tmpT",null); 112 instance.registerToByteableRegistry(); 113 } 114 } | Popular Tags |