KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > metadata > MessageDestinationRefMetaData


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.metadata;
23
24 import org.w3c.dom.Element JavaDoc;
25
26 import org.jboss.deployment.DeploymentException;
27
28 /**
29  * Message Destination Reference Metadata
30  *
31  * @author <a HREF="mailto:adrian@jboss.com">Adrian Brock</a>.
32  * @version $Revision: 57300 $
33  */

34 public class MessageDestinationRefMetaData extends Ref
35 {
36    // Constants -----------------------------------------------------
37

38    public static final int CONSUMES = 1;
39    public static final int PRODUCES = 2;
40    public static final int CONSUMESPRODUCES = 3;
41    
42    // Attributes ----------------------------------------------------
43

44    /** The reference name, it is unique by schema validation */
45    private String JavaDoc refName;
46    
47    /** The type of destination */
48    private String JavaDoc type;
49    
50    /** The usage of destination */
51    private int usage;
52    
53    /** The link */
54    private String JavaDoc link;
55    
56    /** The jndi name */
57    private String JavaDoc jndiName;
58
59    // Static --------------------------------------------------------
60

61    // Constructors --------------------------------------------------
62

63    public MessageDestinationRefMetaData()
64    {
65    }
66
67    // Public --------------------------------------------------------
68

69    public String JavaDoc getJndiName()
70    {
71       return jndiName;
72    }
73
74    public void setJndiName(String JavaDoc jndiName)
75    {
76       this.jndiName = jndiName;
77    }
78    /**
79     * compatibitly method mapped to jndiName
80     * @return
81     */

82    public String JavaDoc getJNDIName()
83    {
84       return jndiName;
85    }
86
87    public String JavaDoc getLink()
88    {
89       return link;
90    }
91
92    public void setLink(String JavaDoc link)
93    {
94       this.link = link;
95    }
96
97    public String JavaDoc getRefName()
98    {
99       return refName;
100    }
101
102    public void setRefName(String JavaDoc refName)
103    {
104       this.refName = refName;
105    }
106
107    public String JavaDoc getType()
108    {
109       return type;
110    }
111
112    public void setType(String JavaDoc type)
113    {
114       this.type = type;
115    }
116
117    public int getUsage()
118    {
119       return usage;
120    }
121
122    public void setUsage(int usage)
123    {
124       this.usage = usage;
125    }
126    public void setUsage(String JavaDoc usageValue)
127    {
128       if (usageValue.equalsIgnoreCase("Consumes"))
129          usage = CONSUMES;
130       else if (usageValue.equalsIgnoreCase("Produces"))
131          usage = PRODUCES;
132       else if (usageValue.equalsIgnoreCase("ConsumesProduces"))
133          usage = CONSUMESPRODUCES;
134    }
135
136    public void importEjbJarXml(Element JavaDoc element) throws DeploymentException
137    {
138       refName = MetaData.getElementContent(MetaData.getUniqueChild(element, "message-destination-ref-name"));
139
140       type = MetaData.getElementContent(MetaData.getUniqueChild(element, "message-destination-type"));
141
142       String JavaDoc usageValue = MetaData.getElementContent(MetaData.getUniqueChild(element, "message-destination-usage"));
143       usageValue = usageValue.trim();
144       if (usageValue.equalsIgnoreCase("Consumes"))
145          usage = CONSUMES;
146       else if (usageValue.equalsIgnoreCase("Produces"))
147          usage = PRODUCES;
148       else if (usageValue.equalsIgnoreCase("ConsumesProduces"))
149          usage = CONSUMESPRODUCES;
150       else
151          throw new DeploymentException("message-destination-usage should be one of Consumes, Produces, ConsumesProduces");
152
153       Element JavaDoc child = MetaData.getOptionalChild(element, "message-destination-link");
154       if (child != null)
155          link = MetaData.getElementContent(child);
156    }
157
158    public void importJbossXml(Element JavaDoc element) throws DeploymentException
159    {
160       jndiName = MetaData.getElementContent(MetaData.getUniqueChild(element, "jndi-name"));
161    }
162
163    // Package protected ---------------------------------------------
164

165    // Protected -----------------------------------------------------
166

167    // Private -------------------------------------------------------
168

169    // Inner classes -------------------------------------------------
170
}
171
Popular Tags