001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.metadata;
023:
024: import org.w3c.dom.Element;
025:
026: import org.jboss.deployment.DeploymentException;
027:
028: import java.util.HashMap;
029:
030: /**
031: * <description>
032: *
033: * @see <related>
034: * @author <a href="mailto:sebastien.alborini@m4x.org">Sebastien Alborini</a>
035: * @version $Revision: 57209 $
036: */
037: public class EjbRefMetaData extends MetaData {
038: // Constants -----------------------------------------------------
039:
040: // Attributes ----------------------------------------------------
041:
042: // the name used in the bean code
043: private String name;
044:
045: // entity or session
046: private String type;
047:
048: // the 2 interfaces
049: private String home;
050: private String remote;
051:
052: // internal link: map name to link
053: private String link;
054:
055: // external link: map name to jndiName
056: private String jndiName;
057:
058: private HashMap invokerMap = new HashMap();
059:
060: // Static --------------------------------------------------------
061:
062: // Constructors --------------------------------------------------
063: public EjbRefMetaData() {
064: }
065:
066: // Public --------------------------------------------------------
067:
068: public String getName() {
069: return name;
070: }
071:
072: public String getType() {
073: return type;
074: }
075:
076: public String getHome() {
077: return home;
078: }
079:
080: public String getRemote() {
081: return remote;
082: }
083:
084: public String getLink() {
085: return link;
086: }
087:
088: public String getJndiName() {
089: return jndiName;
090: }
091:
092: public String getInvokerBinding(String bindingName) {
093: return (String) invokerMap.get(bindingName);
094: }
095:
096: public void importEjbJarXml(Element element)
097: throws DeploymentException {
098: name = getElementContent(getUniqueChild(element, "ejb-ref-name"));
099: type = getElementContent(getUniqueChild(element, "ejb-ref-type"));
100: home = getElementContent(getUniqueChild(element, "home"));
101: remote = getElementContent(getUniqueChild(element, "remote"));
102: link = getElementContent(getOptionalChild(element, "ejb-link"));
103: }
104:
105: public void importJbossXml(Element element)
106: throws DeploymentException {
107: jndiName = getElementContent(getOptionalChild(element,
108: "jndi-name"));
109: }
110:
111: public void importJbossXml(String invokerBinding, Element element)
112: throws DeploymentException {
113: String refJndiName = getElementContent(getOptionalChild(
114: element, "jndi-name"));
115: invokerMap.put(invokerBinding, refJndiName);
116: }
117:
118: // Package protected ---------------------------------------------
119:
120: // Protected -----------------------------------------------------
121:
122: // Private -------------------------------------------------------
123:
124: // Inner classes -------------------------------------------------
125: }
|