1 17 18 package org.apache.geronimo.console.jmsmanager; 19 20 import javax.jms.Queue ; 21 22 public class DestinationInfo implements Comparable { 23 24 private final String name; 25 26 private final String physicalName; 27 28 private final Class type; 29 30 private final String applicationName; 31 32 private final String moduleName; 33 34 private final String configURI; 35 36 public DestinationInfo(String name, String physicalName, Class type, 37 String applicationName, String moduleName, String configURI) { 38 this.name = name; 39 this.physicalName = physicalName; 40 this.type = type; 41 this.applicationName = applicationName; 42 this.moduleName = moduleName; 43 this.configURI = configURI; 44 } 45 46 public String getName() { 47 return name; 48 } 49 50 public String getPhysicalName() { 51 return physicalName; 52 } 53 54 public Class getType() { 55 return type; 56 } 57 58 public String getApplicationName() { 59 return applicationName; 60 } 61 62 public String getModuleName() { 63 return moduleName; 64 } 65 66 public String getConfigURI() { 67 return configURI; 68 } 69 70 78 public boolean isViewable() { 79 return Queue .class.isAssignableFrom(type) || isConsoleManaged(); 80 } 81 82 90 public boolean isRemovable() { 91 return isConsoleManaged(); 92 } 93 94 101 private boolean isConsoleManaged() { 102 return configURI.indexOf(AbstractJMSManager.BASE_CONFIG_URI + name) > -1; 103 } 104 105 public int compareTo(Object o) { 106 if (o instanceof DestinationInfo) { 107 DestinationInfo rhs = (DestinationInfo) o; 108 if (rhs.isRemovable() != this.isRemovable()) { 111 if (this.isRemovable()) { 112 return -1; 113 } else { 114 return 1; 115 } 116 } else if (rhs.isViewable() != this.isViewable()) { 119 if (this.isViewable()) { 120 return -1; 121 } else { 122 return 1; 123 } 124 } else { 126 return this.name.compareTo(rhs.getName()); 127 } 128 } 129 return 1; 130 } 131 132 } 133 | Popular Tags |