KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > proxy > ejb > EJBMetaDataImplIIOP


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.proxy.ejb;
23
24 import java.io.Serializable JavaDoc;
25 import javax.ejb.EJBMetaData JavaDoc;
26 import javax.ejb.EJBHome JavaDoc;
27
28 /**
29  * An implementation of the EJBMetaData interface which allows a
30  * client to obtain the enterprise Bean's meta-data information.
31  *
32  * @author Rickard ???berg (rickard.oberg@telkel.com)
33  * @author <a HREF="mailto:marc.fleury@telkel.com">Marc Fleury</a>
34  * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a>
35  * @author <a HREF="mailto:reverbel@ime.usp.br">Francisco Reverbel</a>
36  * @version $Revision: 37459 $
37  */

38 public class EJBMetaDataImplIIOP implements EJBMetaData JavaDoc, Serializable JavaDoc
39 {
40    // Attributes ----------------------------------------------------
41
private final Class JavaDoc remoteClass;
42
43    private final Class JavaDoc homeClass;
44
45    private final Class JavaDoc pkClass;
46
47    private final boolean session;
48
49    private final boolean statelessSession;
50
51    private final EJBHome JavaDoc home;
52
53    // Constructors --------------------------------------------------
54
/**
55     * Constructs an <code>EJBMetaDataImplIIOP</code>.
56     */

57    public EJBMetaDataImplIIOP(Class JavaDoc remoteClass, Class JavaDoc homeClass, Class JavaDoc pkClass, boolean session,
58          boolean statelessSession, EJBHome JavaDoc home)
59    {
60       this.remoteClass = remoteClass;
61       this.homeClass = homeClass;
62       this.pkClass = pkClass;
63       this.session = session;
64       this.statelessSession = statelessSession;
65       this.home = home;
66    }
67
68    // EJBMetaData ---------------------------------------------------
69
/**
70     * Obtains the home interface of the enterprise Bean.
71     */

72    public EJBHome JavaDoc getEJBHome()
73    {
74       return home;
75    }
76
77    /**
78     * Obtains the <code>Class</code> object for the enterprise Bean's home
79     * interface.
80     */

81    public Class JavaDoc getHomeInterfaceClass()
82    {
83       return homeClass;
84    }
85
86    /**
87     * Obtains the <code>Class</code> object for the enterprise Bean's remote
88     * interface.
89     */

90    public Class JavaDoc getRemoteInterfaceClass()
91    {
92       return remoteClass;
93    }
94
95    /**
96     * Obtains the <code>Class</code> object for the enterprise Bean's primary
97     * key class.
98     */

99    public Class JavaDoc getPrimaryKeyClass()
100    {
101       if (session == true)
102          throw new RuntimeException JavaDoc("A session bean does not have a primary key class");
103       return pkClass;
104    }
105
106    /**
107     * Tests if the enterprise Bean's type is "session".
108     *
109     * @return true if the type of the enterprise Bean is session bean.
110     */

111    public boolean isSession()
112    {
113       return session;
114    }
115
116    /**
117     * Tests if the enterprise Bean's type is "stateless session".
118     *
119     * @return true if the type of the enterprise Bean is stateless session.
120     */

121    public boolean isStatelessSession()
122    {
123       return statelessSession;
124    }
125 }
Popular Tags