001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.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: EasyBeansMetaData.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.container.svc;
025:
026: import javax.ejb.EJBException;
027: import javax.ejb.EJBHome;
028: import javax.ejb.EJBMetaData;
029:
030: /**
031: * Metadata that are provided to the EJB 2.1 view clients.
032: * @author Florent Benoit
033: */
034: public class EasyBeansMetaData implements EJBMetaData {
035:
036: /**
037: * Boolean used to indicate if the bean is a stateless bean or not.
038: */
039: private boolean stateless = false;
040:
041: /**
042: * EJB Home object.
043: */
044: private EJBHome ejbHome = null;
045:
046: /**
047: *Home interface class object.
048: */
049: private Class homeInterfaceClass = null;
050:
051: /**
052: * Remote Home interface class object.
053: */
054: private Class remoteInterfaceClass = null;
055:
056: /**
057: * Build a new metadata object with the given arguments.
058: * @param ejbHome the given ejb home object
059: * @param homeInterfaceClass the given interface used for the Home.
060: * @param remoteInterfaceClass the given interface used for the remote.
061: * @param stateless if true, it means that it is a stateless object.
062: */
063: public EasyBeansMetaData(final EJBHome ejbHome,
064: final Class homeInterfaceClass,
065: final Class remoteInterfaceClass, final boolean stateless) {
066: this .ejbHome = ejbHome;
067: this .homeInterfaceClass = homeInterfaceClass;
068: this .remoteInterfaceClass = remoteInterfaceClass;
069: this .stateless = stateless;
070: }
071:
072: /**
073: * Obtain the remote home interface of the enterprise Bean.
074: * @return the remote home interface of the enterprise Bean.
075: */
076: public EJBHome getEJBHome() {
077: return ejbHome;
078: }
079:
080: /**
081: * Obtain the Class object for the enterprise Bean's remote home interface.
082: * @return the Class object for the enterprise Bean's remote home interface.
083: */
084: public Class getHomeInterfaceClass() {
085: return homeInterfaceClass;
086: }
087:
088: /**
089: * Obtain the Class object for the enterprise Bean's remote interface.
090: * @return the Class object for the enterprise Bean's remote interface.
091: */
092: public Class getRemoteInterfaceClass() {
093: return remoteInterfaceClass;
094: }
095:
096: /**
097: * Obtain the Class object for the enterprise Bean's primary key class.
098: * @return the Class object for the enterprise Bean's primary key class.
099: */
100: public Class getPrimaryKeyClass() {
101: // session bean don't have primary key class
102: throw new EJBException(
103: "getPrimaryKeyClass() not allowed for session beans.");
104: }
105:
106: /**
107: * Test if the enterprise Bean's type is "session".
108: * @return True if the type of the enterprise Bean is session bean.
109: */
110: public boolean isSession() {
111: // always true as entity 2.1 are not supported
112: return true;
113: }
114:
115: /**
116: * Test if the enterprise Bean's type is "stateless session".
117: * @return True if the type of the enterprise Bean is stateless session.
118: */
119: public boolean isStatelessSession() {
120: return stateless;
121: }
122:
123: }
|