KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.w3c.dom.Element JavaDoc;
26
27 import org.jboss.deployment.DeploymentException;
28
29 /**
30  * An ejb-local-ref representation
31  *
32  * @author <a HREF="mailto:docodan@mvcsoft.com">Daniel OConnor</a>
33  * @author Scott.Stark@jboss.org
34  * @version $Revision: 57300 $
35  */

36 public class EjbLocalRefMetaData extends Ref
37 {
38    // Constants -----------------------------------------------------
39

40    // Attributes ----------------------------------------------------
41

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

63    // Constructors --------------------------------------------------
64

65    // Public --------------------------------------------------------
66

67    public String JavaDoc getName()
68    {
69       return name;
70    }
71    public void setName(String JavaDoc name)
72    {
73       this.name = name;
74    }
75
76    public String JavaDoc getType()
77    {
78       return type;
79    }
80
81    public void setType(String JavaDoc type)
82    {
83       this.type = type;
84    }
85
86    public String JavaDoc getLocalHome()
87    {
88       return localHome;
89    }
90    public void setLocalHome(String JavaDoc localHome)
91    {
92       this.localHome = localHome;
93    }
94
95    public String JavaDoc getLocal()
96    {
97       return local;
98    }
99    public void setLocal(String JavaDoc local)
100    {
101       this.local = local;
102    }
103
104    public String JavaDoc getLink()
105    {
106       return link;
107    }
108    public void setLink(String JavaDoc link)
109    {
110       this.link = link;
111    }
112
113    public String JavaDoc getJndiName()
114    {
115       return jndiName;
116    }
117    public void setJndiName(String JavaDoc jndiName)
118    {
119       this.jndiName = jndiName;
120    }
121
122    public String JavaDoc getInvokerBinding(String JavaDoc bindingName)
123    {
124       return (String JavaDoc) invokerMap.get(bindingName);
125    }
126
127    public void importEjbJarXml(Element JavaDoc element) throws DeploymentException
128    {
129       name = MetaData.getElementContent(MetaData.getUniqueChild(element, "ejb-ref-name"));
130       type = MetaData.getElementContent(MetaData.getUniqueChild(element, "ejb-ref-type"));
131       localHome = MetaData.getElementContent(MetaData.getUniqueChild(element, "local-home"));
132       local = MetaData.getElementContent(MetaData.getUniqueChild(element, "local"));
133       link = MetaData.getElementContent(MetaData.getOptionalChild(element, "ejb-link"));
134    }
135    
136    public void importJbossXml(Element JavaDoc element) throws DeploymentException {
137       jndiName = MetaData.getElementContent(MetaData.getOptionalChild(element, "local-jndi-name"));
138    }
139    
140     public void importJbossXml(String JavaDoc invokerBinding, Element JavaDoc element) throws DeploymentException
141     {
142       String JavaDoc refJndiName = MetaData.getElementContent(MetaData.getOptionalChild(element, "local-jndi-name"));
143       invokerMap.put(invokerBinding, refJndiName);
144     }
145 }
146
Popular Tags