KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfox > ejb > meta > MDBDescriptor


1 /* JFox, the OpenSource J2EE Application Server
2  *
3  * Distributable under GNU LGPL license by gun.org
4  * more details please visit http://www.huihoo.org/jfox
5  */

6
7 package org.jfox.ejb.meta;
8
9 import javax.ejb.EJBException JavaDoc;
10
11 import org.jfox.ioc.util.XMLUtils;
12 import org.w3c.dom.Node JavaDoc;
13
14 /**
15  * @author <a HREF="mailto:young_yy@hotmail.com">Young Yang</a>
16  */

17
18 public class MDBDescriptor extends EJBDescriptor {
19     private String JavaDoc destination = null;
20
21     private String JavaDoc acknowledgeMode = null;
22     private String JavaDoc destinationType = "javax.jms.Queue";
23     private String JavaDoc subscriptionDurability = "Durable";
24
25     public void processXML(Node JavaDoc node) throws EJBDescriptionException {
26         setAcknowledgeMode(XMLUtils.getChildNodeValueOf(node, "acknowledge-mode"));
27
28         Node JavaDoc 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 JavaDoc 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 JavaDoc _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 JavaDoc getDestination() {
47         return destination;
48     }
49
50     public void setDestination(String JavaDoc destination) {
51         this.destination = destination;
52     }
53
54     public String JavaDoc getAcknowledgeMode() {
55         return acknowledgeMode;
56     }
57
58     public void setAcknowledgeMode(String JavaDoc acknowledgeMode) {
59         this.acknowledgeMode = acknowledgeMode;
60     }
61
62     public String JavaDoc getDestinationType() {
63         return destinationType;
64     }
65
66     public void setDestinationType(String JavaDoc destinationType) {
67         this.destinationType = destinationType;
68     }
69
70     public String JavaDoc getSubscriptionDurability() {
71         return subscriptionDurability;
72     }
73
74     public void setSubscriptionDurability(String JavaDoc subscriptionDurability) {
75         this.subscriptionDurability = subscriptionDurability;
76     }
77
78     public String JavaDoc getHomeClassName() {
79         throw new EJBException JavaDoc("MessageDriven Bean has no Home Class");
80     }
81
82     public String JavaDoc getRemoteClassName() {
83         throw new EJBException JavaDoc("MessageDriven Bean has no Remote Class");
84     }
85
86     public void setHomeClassName(String JavaDoc s) {
87         throw new EJBException JavaDoc("MessageDriven Bean has no Home Class");
88     }
89
90     public void setRemoteClassName(String JavaDoc s) {
91         throw new EJBException JavaDoc("MessageDriven Bean has no Remote Class");
92     }
93
94     public String JavaDoc getJndiName() {
95         throw new EJBException JavaDoc("MessageDriven Bean has no JNDI Name");
96     }
97
98     public void setJndiName(String JavaDoc s) {
99         throw new EJBException JavaDoc("MessageDriven Bean has no JNDI Name");
100     }
101
102     public static void main(String JavaDoc[] args) {
103
104     }
105 }
106
Popular Tags