KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > genbase > archive > Ejb


1 /**
2  * JOnAS : Java(TM) OpenSource Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Ejb.java,v 1.2 2005/04/27 12:28:21 benoitf Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas_lib.genbase.archive;
27
28 import java.util.List JavaDoc;
29 import java.util.Vector JavaDoc;
30
31 import org.w3c.dom.Element JavaDoc;
32
33 import org.objectweb.jonas_ejb.deployment.api.BeanDesc;
34
35 import org.objectweb.jonas_lib.deployment.api.EjbRefDesc;
36
37 import org.objectweb.jonas_ws.deployment.api.ServiceRefDesc;
38
39 /**
40  * Ejb represent a Bean in an EjbJar.
41  * @author Guillaume Sauthier
42  */

43 public class Ejb implements EjbRefModule, WsClient {
44
45     /**
46      * service-ref list
47      */

48     private List JavaDoc sRefs;
49
50     /**
51      * ejb-ref list
52      */

53     private List JavaDoc ejbRefs;
54
55     /**
56      * bean name
57      */

58     private String JavaDoc name;
59
60     /**
61      * jonas- element (session, entity, message)
62      */

63     private Element JavaDoc jbean;
64
65     /**
66      * Creates a new Ejb from a BeanDesc
67      * @param bd the BeanDesc
68      * @param bean jonas specific bean Element
69      * (jonas-session/jonas-entity/jonas-message-driven)
70      */

71     public Ejb(BeanDesc bd, Element JavaDoc bean) {
72         // get name
73
name = bd.getEjbName();
74
75         // store jonas informations
76
jbean = bean;
77
78         // we want a List of service-ref
79
sRefs = new Vector JavaDoc();
80
81         ServiceRefDesc[] refs = bd.getServiceRefDesc();
82
83         for (int i = 0; i < refs.length; i++) {
84             sRefs.add(refs[i]);
85         }
86
87         // List of ejb-refs
88
ejbRefs = new Vector JavaDoc();
89         EjbRefDesc[] refDesc = bd.getEjbRefDesc();
90
91         for (int i = 0; i < refDesc.length; i++) {
92             ejbRefs.add(refDesc[i]);
93         }
94     }
95
96     /**
97      * Returns the list of service-ref elements contained by a module.
98      * @return the list of service-ref elements contained by a module.
99      */

100     public List JavaDoc getServiceRefDescs() {
101         return sRefs;
102     }
103
104
105     /**
106      * Returns the list of ejb-ref elements contained by a module.
107      * @return the list of ejb-ref elements contained by a module.
108      */

109     public List JavaDoc getEjbRefDescs() {
110         return ejbRefs;
111     }
112
113     /**
114      * Returns the bean name.
115      * @return the bean name.
116      */

117     public String JavaDoc getName() {
118         return name;
119     }
120
121     /**
122      * Returns the bean element.
123      * @return the bean element.
124      */

125     public Element JavaDoc getJonasBeanElement() {
126         return jbean;
127     }
128
129     /**
130      * Close this archive
131      */

132     public void close() {
133         sRefs = null;
134         ejbRefs = null;
135         name = null;
136         jbean = null;
137     }
138
139 }
Popular Tags