1 6 7 package org.jfox.ejb.meta; 8 9 import javax.ejb.EJBException ; 10 11 import org.jfox.ioc.util.XMLUtils; 12 import org.w3c.dom.Node ; 13 14 17 18 public class MDBDescriptor extends EJBDescriptor { 19 private String destination = null; 20 21 private String acknowledgeMode = null; 22 private String destinationType = "javax.jms.Queue"; 23 private String subscriptionDurability = "Durable"; 24 25 public void processXML(Node node) throws EJBDescriptionException { 26 setAcknowledgeMode(XMLUtils.getChildNodeValueOf(node, "acknowledge-mode")); 27 28 Node mdd = XMLUtils.getChildNodeOf(node,"message-driven-destination"); 29 setDestinationType(XMLUtils.getChildNodeValueOf(mdd,"destination-type")); 30 setSubscriptionDurability(XMLUtils.getAtrributeValueOf(mdd,"subscription-durability")); 31 32 super.processXML(node); 33 String ejbName = getDisplayName(); 34 int index = ejbName.indexOf(":"); 35 if(index < 0) { 36 throw new EJBDescriptionException("no destination jndi name specified, must use display-name like \"ExampleMDB:destination=queue/Q1\" to specify destination jndi name."); 37 } 38 String _destination = ejbName.substring(index+1).trim(); 39 int _index = _destination.indexOf("="); 40 if(_index < 0){ 41 throw new EJBDescriptionException("destination jndi name format error, must be \"ExampleMDB:destination=queue/Q1\" to specify destination jndi name."); 42 } 43 destination = _destination.substring(_index+1).trim(); 44 } 45 46 public String getDestination() { 47 return destination; 48 } 49 50 public void setDestination(String destination) { 51 this.destination = destination; 52 } 53 54 public String getAcknowledgeMode() { 55 return acknowledgeMode; 56 } 57 58 public void setAcknowledgeMode(String acknowledgeMode) { 59 this.acknowledgeMode = acknowledgeMode; 60 } 61 62 public String getDestinationType() { 63 return destinationType; 64 } 65 66 public void setDestinationType(String destinationType) { 67 this.destinationType = destinationType; 68 } 69 70 public String getSubscriptionDurability() { 71 return subscriptionDurability; 72 } 73 74 public void setSubscriptionDurability(String subscriptionDurability) { 75 this.subscriptionDurability = subscriptionDurability; 76 } 77 78 public String getHomeClassName() { 79 throw new EJBException ("MessageDriven Bean has no Home Class"); 80 } 81 82 public String getRemoteClassName() { 83 throw new EJBException ("MessageDriven Bean has no Remote Class"); 84 } 85 86 public void setHomeClassName(String s) { 87 throw new EJBException ("MessageDriven Bean has no Home Class"); 88 } 89 90 public void setRemoteClassName(String s) { 91 throw new EJBException ("MessageDriven Bean has no Remote Class"); 92 } 93 94 public String getJndiName() { 95 throw new EJBException ("MessageDriven Bean has no JNDI Name"); 96 } 97 98 public void setJndiName(String s) { 99 throw new EJBException ("MessageDriven Bean has no JNDI Name"); 100 } 101 102 public static void main(String [] args) { 103 104 } 105 } 106 | Popular Tags |