1 23 package com.sun.enterprise.deployment; 24 25 import java.util.Set ; 26 27 import com.sun.enterprise.deployment.types.MessageDestinationReference; 28 import com.sun.enterprise.util.LocalStringManagerImpl; 29 30 31 38 39 public class MessageDestinationReferenceDescriptor extends EnvironmentProperty 40 implements MessageDestinationReference { 41 42 public static final String CONSUMES = "Consumes"; 44 public static final String PRODUCES = "Produces"; 45 public static final String CONSUMES_PRODUCES = "ConsumesProduces"; 46 47 private static LocalStringManagerImpl localStrings = 48 new LocalStringManagerImpl(MessageDestinationReferenceDescriptor.class); 49 50 private BundleDescriptor referringBundle; 51 52 private String usage; 53 54 private String destinationType; 55 56 private String jndiName; 58 59 private MessageDestinationReferencerImpl referencer; 61 62 65 public MessageDestinationReferenceDescriptor(MessageDestinationReferenceDescriptor other) { 66 super(other); 67 referringBundle = other.referringBundle; usage = other.usage; destinationType = other.destinationType; referencer = new MessageDestinationReferencerImpl(other.referencer); 71 } 72 73 81 public MessageDestinationReferenceDescriptor(String name, String desc) { 82 super(name, "", desc); 83 referencer = new MessageDestinationReferencerImpl(this); 84 } 85 86 89 90 public MessageDestinationReferenceDescriptor() { 91 referencer = new MessageDestinationReferencerImpl(this); 92 } 93 94 98 public String getUsage() { 99 return usage; 100 } 101 102 106 public void setUsage(String destUsage) { 107 usage = destUsage; 108 } 109 110 public String getDestinationType() { 111 return destinationType; 112 } 113 114 public void setDestinationType(String type) { 115 destinationType = type; 116 } 117 118 public String getJndiName() { 119 return (jndiName != null && ! jndiName.equals("")) ? 120 jndiName : mappedName; 121 } 122 123 public void setJndiName(String physicalDestinationName) { 124 jndiName = physicalDestinationName; 125 } 126 127 public String getInjectResourceType() { 128 return getDestinationType(); 129 } 130 131 public void setInjectResourceType(String resourceType) { 132 setDestinationType(resourceType); 133 } 134 135 139 public void setReferringBundleDescriptor(BundleDescriptor referringBundle) 140 { 141 this.referringBundle = referringBundle; 142 } 143 144 148 public BundleDescriptor getReferringBundleDescriptor() 149 { 150 return referringBundle; 151 } 152 153 157 public boolean isLinkedToMessageDestination() { 158 return referencer.isLinkedToMessageDestination(); 159 } 160 161 164 public String getMessageDestinationLinkName() { 165 return referencer.getMessageDestinationLinkName(); 166 } 167 168 171 public void setMessageDestinationLinkName(String linkName) { 172 referencer.setMessageDestinationLinkName(linkName); 173 } 174 175 public MessageDestinationDescriptor setMessageDestinationLinkName 176 (String linkName, boolean resolveLink) { 177 return referencer.setMessageDestinationLinkName(linkName, resolveLink); 178 } 179 180 public MessageDestinationDescriptor resolveLinkName() { 181 return referencer.resolveLinkName(); 182 } 183 184 public boolean ownedByMessageDestinationRef() { 185 return true; 186 } 187 188 191 public MessageDestinationReferenceDescriptor getMessageDestinationRefOwner 192 () { 193 return this; 194 } 195 196 199 public boolean ownedByMessageBean() { 200 return false; 201 } 202 203 206 public EjbMessageBeanDescriptor getMessageBeanOwner() { 207 return null; 208 } 209 210 213 public MessageDestinationDescriptor getMessageDestination() { 214 return referencer.getMessageDestination(); 215 } 216 217 220 public void setMessageDestination(MessageDestinationDescriptor newMsgDest) { 221 referencer.setMessageDestination(newMsgDest); 222 } 223 224 226 227 public void print(StringBuffer toStringBuffer) { 228 if (isLinkedToMessageDestination()) { 229 toStringBuffer.append("Resolved Message-Destination-Ref ").append(getName()).append( 230 "points to logical message destination ").append(getMessageDestination().getName()); 231 } else { 232 toStringBuffer.append("Unresolved Message-Destination-Ref ").append(getName()).append( 233 "@").append(getType()).append("@").append(usage); 234 } 235 } 236 237 238 public boolean equals(Object object) { 239 if (object instanceof MessageDestinationReference) { 240 MessageDestinationReference reference = 241 (MessageDestinationReference) object; 242 return reference.getName().equals(this.getName()); 243 } 244 return false; 245 } 246 } 247 | Popular Tags |