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.proxy.ejb;
023:
024: import java.io.Serializable;
025: import java.rmi.RemoteException;
026: import javax.ejb.HomeHandle;
027: import javax.ejb.EJBMetaData;
028: import javax.ejb.EJBHome;
029: import javax.ejb.EJBException;
030:
031: /**
032: * An implementation of the EJBMetaData interface which allows a
033: * client to obtain the enterprise Bean's meta-data information.
034: *
035: * @author Rickard �berg (rickard.oberg@telkel.com)
036: * @author <a href="mailto:marc.fleury@telkel.com">Marc Fleury</a>
037: * @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
038: * @author <a href="mailto:reverbel@ime.usp.br">Francisco Reverbel</a>
039: * @version $Revision: 57194 $
040: */
041: public class EJBMetaDataImplIIOP implements EJBMetaData, Serializable {
042: static final long serialVersionUID = -5431383987254746466L;
043:
044: // Attributes ----------------------------------------------------
045: private final Class remoteClass;
046:
047: private final Class homeClass;
048:
049: private final Class pkClass;
050:
051: private final boolean session;
052:
053: private final boolean statelessSession;
054:
055: private final EJBHome home;
056:
057: // Constructors --------------------------------------------------
058: /**
059: * Constructs an <code>EJBMetaDataImplIIOP</code>.
060: */
061: public EJBMetaDataImplIIOP(Class remoteClass, Class homeClass,
062: Class pkClass, boolean session, boolean statelessSession,
063: EJBHome home) {
064: this .remoteClass = remoteClass;
065: this .homeClass = homeClass;
066: this .pkClass = pkClass;
067: this .session = session;
068: this .statelessSession = statelessSession;
069: this .home = home;
070: }
071:
072: // EJBMetaData ---------------------------------------------------
073: /**
074: * Obtains the home interface of the enterprise Bean.
075: */
076: public EJBHome getEJBHome() {
077: return home;
078: }
079:
080: /**
081: * Obtains the <code>Class</code> object for the enterprise Bean's home
082: * interface.
083: */
084: public Class getHomeInterfaceClass() {
085: return homeClass;
086: }
087:
088: /**
089: * Obtains the <code>Class</code> object for the enterprise Bean's remote
090: * interface.
091: */
092: public Class getRemoteInterfaceClass() {
093: return remoteClass;
094: }
095:
096: /**
097: * Obtains the <code>Class</code> object for the enterprise Bean's primary
098: * key class.
099: */
100: public Class getPrimaryKeyClass() {
101: if (session == true)
102: throw new RuntimeException(
103: "A session bean does not have a primary key class");
104: return pkClass;
105: }
106:
107: /**
108: * Tests if the enterprise Bean's type is "session".
109: *
110: * @return true if the type of the enterprise Bean is session bean.
111: */
112: public boolean isSession() {
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: return statelessSession;
123: }
124: }
|