1 18 package org.apache.activemq.filter; 19 20 import org.apache.activemq.command.ActiveMQDestination; 21 import org.apache.activemq.command.ActiveMQQueue; 22 import org.apache.activemq.command.ActiveMQTopic; 23 import org.springframework.beans.factory.InitializingBean; 24 25 31 public abstract class DestinationMapEntry implements InitializingBean, Comparable { 32 33 private ActiveMQDestination destination; 34 35 36 public int compareTo(Object that) { 37 if (that instanceof DestinationMapEntry) { 38 DestinationMapEntry thatEntry = (DestinationMapEntry) that; 39 return ActiveMQDestination.compare(destination, thatEntry.destination); 40 } 41 else if (that == null) { 42 return 1; 43 } 44 else { 45 return getClass().getName().compareTo(that.getClass().getName()); 46 } 47 } 48 49 52 public void setQueue(String name) { 53 setDestination(new ActiveMQQueue(name)); 54 } 55 56 59 public void setTopic(String name) { 60 setDestination(new ActiveMQTopic(name)); 61 } 62 63 public ActiveMQDestination getDestination() { 64 return destination; 65 } 66 67 public void setDestination(ActiveMQDestination destination) { 68 this.destination = destination; 69 } 70 71 public void afterPropertiesSet() throws Exception { 72 if (destination == null) { 73 throw new IllegalArgumentException ("You must specify the 'destination' property"); 74 } 75 } 76 77 public Object getValue() { 78 return this; 79 } 80 } 81 | Popular Tags |