001: /**
002: * JOnAS : Java(TM) OpenSource Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: Ejb.java 6657 2005-04-27 12:28:21Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas_lib.genbase.archive;
025:
026: import java.util.List;
027: import java.util.Vector;
028:
029: import org.w3c.dom.Element;
030:
031: import org.objectweb.jonas_ejb.deployment.api.BeanDesc;
032:
033: import org.objectweb.jonas_lib.deployment.api.EjbRefDesc;
034:
035: import org.objectweb.jonas_ws.deployment.api.ServiceRefDesc;
036:
037: /**
038: * Ejb represent a Bean in an EjbJar.
039: * @author Guillaume Sauthier
040: */
041: public class Ejb implements EjbRefModule, WsClient {
042:
043: /**
044: * service-ref list
045: */
046: private List sRefs;
047:
048: /**
049: * ejb-ref list
050: */
051: private List ejbRefs;
052:
053: /**
054: * bean name
055: */
056: private String name;
057:
058: /**
059: * jonas- element (session, entity, message)
060: */
061: private Element jbean;
062:
063: /**
064: * Creates a new Ejb from a BeanDesc
065: * @param bd the BeanDesc
066: * @param bean jonas specific bean Element
067: * (jonas-session/jonas-entity/jonas-message-driven)
068: */
069: public Ejb(BeanDesc bd, Element bean) {
070: // get name
071: name = bd.getEjbName();
072:
073: // store jonas informations
074: jbean = bean;
075:
076: // we want a List of service-ref
077: sRefs = new Vector();
078:
079: ServiceRefDesc[] refs = bd.getServiceRefDesc();
080:
081: for (int i = 0; i < refs.length; i++) {
082: sRefs.add(refs[i]);
083: }
084:
085: // List of ejb-refs
086: ejbRefs = new Vector();
087: EjbRefDesc[] refDesc = bd.getEjbRefDesc();
088:
089: for (int i = 0; i < refDesc.length; i++) {
090: ejbRefs.add(refDesc[i]);
091: }
092: }
093:
094: /**
095: * Returns the list of service-ref elements contained by a module.
096: * @return the list of service-ref elements contained by a module.
097: */
098: public List getServiceRefDescs() {
099: return sRefs;
100: }
101:
102: /**
103: * Returns the list of ejb-ref elements contained by a module.
104: * @return the list of ejb-ref elements contained by a module.
105: */
106: public List getEjbRefDescs() {
107: return ejbRefs;
108: }
109:
110: /**
111: * Returns the bean name.
112: * @return the bean name.
113: */
114: public String getName() {
115: return name;
116: }
117:
118: /**
119: * Returns the bean element.
120: * @return the bean element.
121: */
122: public Element getJonasBeanElement() {
123: return jbean;
124: }
125:
126: /**
127: * Close this archive
128: */
129: public void close() {
130: sRefs = null;
131: ejbRefs = null;
132: name = null;
133: jbean = null;
134: }
135:
136: }
|