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 java.util.HashMap;
025: import org.w3c.dom.Element;
026:
027: import org.jboss.deployment.DeploymentException;
028:
029: /**
030: * <description>
031: *
032: * @see <related>
033: * @author <a href="mailto:docodan@mvcsoft.com">Daniel OConnor</a>
034: */
035: public class EjbLocalRefMetaData extends MetaData {
036: // Constants -----------------------------------------------------
037:
038: // Attributes ----------------------------------------------------
039:
040: // the name used in the bean code
041: private String name;
042:
043: // entity or session
044: private String type;
045:
046: // the 2 interfaces
047: private String localHome;
048: private String local;
049:
050: // internal link: map name to link
051: private String link;
052:
053: // external link: map name to jndiName
054: private String jndiName;
055:
056: private HashMap invokerMap = new HashMap();
057:
058: // Static --------------------------------------------------------
059:
060: // Constructors --------------------------------------------------
061:
062: // Public --------------------------------------------------------
063:
064: public String getName() {
065: return name;
066: }
067:
068: public String getType() {
069: return type;
070: }
071:
072: public String getLocalHome() {
073: return localHome;
074: }
075:
076: public String getLocal() {
077: return local;
078: }
079:
080: public String getLink() {
081: return link;
082: }
083:
084: public String getJndiName() {
085: return jndiName;
086: }
087:
088: public String getInvokerBinding(String bindingName) {
089: return (String) invokerMap.get(bindingName);
090: }
091:
092: public void importEjbJarXml(Element element)
093: throws DeploymentException {
094: name = getElementContent(getUniqueChild(element, "ejb-ref-name"));
095: type = getElementContent(getUniqueChild(element, "ejb-ref-type"));
096: localHome = getElementContent(getUniqueChild(element,
097: "local-home"));
098: local = getElementContent(getUniqueChild(element, "local"));
099: link = getElementContent(getOptionalChild(element, "ejb-link"));
100: }
101:
102: public void importJbossXml(Element element)
103: throws DeploymentException {
104: jndiName = getElementContent(getOptionalChild(element,
105: "local-jndi-name"));
106: }
107:
108: public void importJbossXml(String invokerBinding, Element element)
109: throws DeploymentException {
110: String refJndiName = getElementContent(getOptionalChild(
111: element, "local-jndi-name"));
112: invokerMap.put(invokerBinding, refJndiName);
113: }
114: }
|