KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > svc > JMetaData


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 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: JMetaData.java,v 1.2 2005/01/12 14:40:21 pelletib Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas_ejb.svc;
27
28 import java.io.Serializable JavaDoc;
29
30 import javax.ejb.EJBException JavaDoc;
31 import javax.ejb.EJBHome JavaDoc;
32 import javax.ejb.EJBMetaData JavaDoc;
33
34 import java.util.logging.Level JavaDoc;
35 import java.util.logging.Logger JavaDoc;
36
37
38 /**
39  * This class is a Serializable class that allows a client to obtain the
40  * enterprise Bean's meta-data information.
41  * @author Philippe Coq
42  */

43 public class JMetaData implements EJBMetaData JavaDoc, Serializable JavaDoc {
44
45     /**
46      * JDK logger to be portable
47      */

48     private static Logger JavaDoc logger = Logger.getLogger("org.objectweb.jonas_ejb.svc");
49
50     /**
51      * EJB Home
52      */

53     private EJBHome JavaDoc home;
54
55     /**
56      * EJB Home class
57      */

58     private Class JavaDoc homeClass;
59
60     /**
61      * EJB Remote class
62      */

63     private Class JavaDoc remoteClass;
64
65     /**
66      * Primary Key Home class
67      */

68     private Class JavaDoc primaryKeyClass;
69
70     /**
71      * True if is a Session Bean
72      */

73     private boolean isSession;
74
75     /**
76      * True if is a Stateless Session Bean
77      */

78     private boolean isStatelessSession;
79
80     /**
81      * Constructor
82      * @param home The EJBHome
83      * @param homeClass EJB Home class
84      * @param remoteClass EJB Remote class
85      * @param isSession true if is a Session Bean
86      * @param isStatelessSession true if is a StatelessSessionBean
87      * @param primaryKeyClass primary key class
88      */

89     public JMetaData(EJBHome JavaDoc home, Class JavaDoc homeClass, Class JavaDoc remoteClass, boolean isSession, boolean isStatelessSession, Class JavaDoc primaryKeyClass) {
90         logger.log(Level.FINE, "");
91         this.home = home;
92         this.homeClass = homeClass;
93         this.remoteClass = remoteClass;
94         this.isSession = isSession;
95         this.isStatelessSession = isStatelessSession;
96         this.primaryKeyClass = primaryKeyClass;
97     }
98
99     // -----------------------------------------------------------------------
100
// EJBMetaData implementation
101
// -----------------------------------------------------------------------
102

103     /**
104      * @return the home interface of the enterprise Bean.
105      */

106     public EJBHome JavaDoc getEJBHome() {
107         return home;
108     }
109
110     /**
111      * @return the Class object for the enterprise Bean's home interface.
112      */

113     public Class JavaDoc getHomeInterfaceClass() {
114         return homeClass;
115     }
116
117     /**
118      * @return the Class object for the enterprise Bean's primary key class.
119      */

120     public Class JavaDoc getPrimaryKeyClass() {
121         if (isSession) {
122             throw new EJBException JavaDoc("getPrimaryKeyClass() not allowed for session");
123         }
124         return primaryKeyClass;
125     }
126
127     /**
128      * @return the Class object for the enterprise Bean's remote interface.
129      */

130     public Class JavaDoc getRemoteInterfaceClass() {
131         return remoteClass;
132     }
133
134     /**
135      * @return True if the enterprise Bean's type is "session".
136      */

137     public boolean isSession() {
138         return isSession;
139     }
140
141     /**
142      * @return True if the type of the enterprise Bean is stateless session.
143      */

144     public boolean isStatelessSession() {
145         return isStatelessSession;
146     }
147
148 }
Popular Tags