KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.HashMap JavaDoc;
25
26 import org.w3c.dom.Element JavaDoc;
27
28 import org.jboss.deployment.DeploymentException;
29 import static org.jboss.metadata.MetaData.*;
30
31 /**
32  * An ejb-ref encapsulation
33  *
34  * @author <a HREF="mailto:sebastien.alborini@m4x.org">Sebastien Alborini</a>
35  * @author Scott.Stark@jboss.org
36  * @version $Revision: 58231 $
37  */

38 public class EjbRefMetaData extends Ref
39 {
40    // Constants -----------------------------------------------------
41

42    // Attributes ----------------------------------------------------
43

44    // the name used in the bean code
45
private String JavaDoc name;
46
47    // entity or session
48
private String JavaDoc type;
49
50    // the 2 interfaces
51
private String JavaDoc home;
52
53    private String JavaDoc remote;
54
55    // internal link: map name to link
56
private String JavaDoc link;
57
58    // external link: map name to jndiName
59
private String JavaDoc jndiName;
60
61    private HashMap JavaDoc invokerMap = new HashMap JavaDoc();
62
63    // Static --------------------------------------------------------
64

65    // Constructors --------------------------------------------------
66
public EjbRefMetaData()
67    {
68    }
69
70    // Public --------------------------------------------------------
71

72
73    public String JavaDoc getHome()
74    {
75       return home;
76    }
77
78    public void setHome(String JavaDoc home)
79    {
80       this.home = home;
81    }
82
83    public HashMap JavaDoc getInvokerMap()
84    {
85       return invokerMap;
86    }
87
88    public void setInvokerMap(HashMap JavaDoc invokerMap)
89    {
90       this.invokerMap = invokerMap;
91    }
92
93    public String JavaDoc getJndiName()
94    {
95       return jndiName;
96    }
97
98    public void setJndiName(String JavaDoc jndiName)
99    {
100       this.jndiName = jndiName;
101    }
102
103    public String JavaDoc getLink()
104    {
105       return link;
106    }
107
108    public void setLink(String JavaDoc link)
109    {
110       this.link = link;
111    }
112
113    public String JavaDoc getName()
114    {
115       return name;
116    }
117
118    public void setName(String JavaDoc name)
119    {
120       this.name = name;
121    }
122
123    public String JavaDoc getRemote()
124    {
125       return remote;
126    }
127
128    public void setRemote(String JavaDoc remote)
129    {
130       this.remote = remote;
131    }
132
133    public String JavaDoc getType()
134    {
135       return type;
136    }
137
138    public void setType(String JavaDoc type)
139    {
140       this.type = type;
141    }
142
143    public String JavaDoc getInvokerBinding(String JavaDoc bindingName)
144    {
145       return (String JavaDoc) invokerMap.get(bindingName);
146    }
147
148    public void addInvokerBinding(String JavaDoc bindingName, String JavaDoc jndiName)
149    {
150       invokerMap.put(bindingName, jndiName);
151    }
152
153    public void importEjbJarXml(Element JavaDoc element) throws DeploymentException {
154       name = getElementContent(getUniqueChild(element, "ejb-ref-name"));
155       type = getElementContent(getUniqueChild(element, "ejb-ref-type"));
156       home = getElementContent(getUniqueChild(element, "home"));
157       remote = getElementContent(getUniqueChild(element, "remote"));
158       link = getElementContent(getOptionalChild(element, "ejb-link"));
159    }
160     
161    public void importJbossXml(Element JavaDoc element) throws DeploymentException {
162       jndiName = getElementContent(getOptionalChild(element, "jndi-name"));
163    }
164     
165    public void importJbossXml(String JavaDoc invokerBinding, Element JavaDoc element) throws DeploymentException
166    {
167       String JavaDoc refJndiName = getElementContent(getOptionalChild(element, "jndi-name"));
168       invokerMap.put(invokerBinding, refJndiName);
169    }
170     
171    // Package protected ---------------------------------------------
172

173    // Protected -----------------------------------------------------
174

175    // Private -------------------------------------------------------
176

177    // Inner classes -------------------------------------------------
178
}
179
Popular Tags