1 14 15 package org.apache.activemq.command; 16 17 import javax.jms.JMSException ; 18 import org.apache.activemq.ActiveMQConnection; 19 import org.apache.commons.logging.Log; 20 import org.apache.commons.logging.LogFactory; 21 22 26 abstract public class ActiveMQTempDestination extends ActiveMQDestination{ 27 28 private static final Log log=LogFactory.getLog(ActiveMQTempDestination.class); 29 protected transient ActiveMQConnection connection; 30 protected transient String connectionId; 31 protected transient int sequenceId; 32 33 public ActiveMQTempDestination(){ 34 } 35 36 public ActiveMQTempDestination(String name){ 37 super(name); 38 } 39 40 public ActiveMQTempDestination(String connectionId,long sequenceId){ 41 super(connectionId+":"+sequenceId); 42 } 43 44 public boolean isTemporary(){ 45 return true; 46 } 47 48 public void delete() throws JMSException { 49 connection.deleteTempDestination(this); 50 } 51 52 public ActiveMQConnection getConnection(){ 53 return connection; 54 } 55 56 public void setConnection(ActiveMQConnection connection){ 57 this.connection=connection; 58 } 59 60 public void setPhysicalName(String physicalName){ 61 super.setPhysicalName(physicalName); 62 if(!isComposite()){ 63 int p=this.physicalName.lastIndexOf(":"); 67 if(p>=0){ 68 String seqStr=this.physicalName.substring(p+1).trim(); 69 if(seqStr!=null&&seqStr.length()>0){ 70 try{ 71 sequenceId=Integer.parseInt(seqStr); 72 }catch(NumberFormatException e){ 73 log.debug("Did not parse sequence Id from "+physicalName); 74 } 75 connectionId=this.physicalName.substring(0,p); 77 } 78 } 79 } 80 } 81 82 public String getConnectionId(){ 83 return connectionId; 84 } 85 86 public void setConnectionId(String connectionId){ 87 this.connectionId=connectionId; 88 } 89 90 public int getSequenceId(){ 91 return sequenceId; 92 } 93 } 94 | Popular Tags |