1 22 package org.jboss.ejb; 23 24 import java.util.HashMap ; 25 26 import javax.ejb.MessageDriven ; 27 28 import javax.ejb.ActivationConfigProperty ; 29 30 36 public class MessageDrivenImpl implements MessageDriven 37 { 38 private String name = ""; 39 private String mn = ""; 40 private String desc = ""; 41 private Class listenerInterface = Object .class; 42 43 private HashMap activationConfigProperties = new HashMap (); 44 45 public MessageDrivenImpl(String name, ActivationConfigProperty [] activationConfigProperties) 46 { 47 this.name = name; 48 for (ActivationConfigProperty property : activationConfigProperties) 49 { 50 this.activationConfigProperties.put(property.propertyName(), property); 51 } 52 } 53 54 public String name() 55 { 56 return name; 57 } 58 59 public ActivationConfigProperty [] activationConfig() 60 { 61 ActivationConfigProperty [] properties = new ActivationConfigProperty [activationConfigProperties.size()]; 62 activationConfigProperties.values().toArray(properties); 63 return properties; 64 } 65 66 public Class annotationType() 67 { 68 return javax.ejb.MessageDriven .class; 69 } 70 71 public String mappedName() { return mn;} 72 public void setMappedName(String mn) { this.mn = mn; } 73 public String description() { return desc;} 74 public void setDescription(String desc) { this.desc = desc; } 75 public Class messageListenerInterface() { return listenerInterface;} 76 public void setMessageListenerInterface(Class clazz) { this.listenerInterface = clazz; } 77 78 public void merge(MessageDriven annotation) 79 { 80 if (name.length() == 0) 81 name = annotation.name(); 82 83 if (mn.length() == 0) 84 mn = annotation.mappedName(); 85 86 if (desc.length() == 0) 87 desc = annotation.description(); 88 89 for (ActivationConfigProperty property : annotation.activationConfig()) 90 { 91 if (!activationConfigProperties.containsKey(property.propertyName())) 92 { 93 activationConfigProperties.put(property.propertyName(), property); 94 } 95 } 96 } 97 } 98 | Popular Tags |