001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.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: SessionStatefulDesc.java 8384 2006-05-24 11:30:11Z durieuxp $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas_ejb.deployment.api;
025:
026: import java.lang.reflect.Method;
027:
028: import org.objectweb.jonas_ejb.deployment.xml.Session;
029: import org.objectweb.jonas_ejb.deployment.xml.AssemblyDescriptor;
030: import org.objectweb.jonas_ejb.deployment.xml.JonasSession;
031: import org.objectweb.jonas_lib.deployment.api.DeploymentDescException;
032: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
033:
034: /**
035: * class to hold meta-information related to a stateful session bean.
036: * At this stage, this is only a tagger class.
037: * @author Christophe Ney [cney@batisseurs.com] : Initial developer
038: * @author Helene Joanin
039: */
040: public class SessionStatefulDesc extends SessionDesc {
041:
042: protected Method isModifiedMethod = null;
043:
044: /**
045: * constructor: called when the DeploymentDescriptor is read.
046: * Currently, called by both GenIC and createContainer.
047: */
048: public SessionStatefulDesc(ClassLoader classLoader, Session ses,
049: AssemblyDescriptor asd, JonasSession jSes,
050: JLinkedList jMDRList, String filename)
051: throws DeploymentDescException {
052: super (classLoader, ses, asd, jSes, jMDRList, filename);
053:
054: // isModifiedMethod
055: if (jSes.getIsModifiedMethodName() != null) {
056: String mName = jSes.getIsModifiedMethodName();
057: try {
058: isModifiedMethod = this .ejbClass.getMethod(mName,
059: new Class[0]);
060: } catch (NoSuchMethodException e) {
061: isModifiedMethod = null;
062: throw new DeploymentDescException(mName
063: + " is not a method of "
064: + this .ejbClass.getName());
065: } catch (SecurityException e) {
066: throw new DeploymentDescException(
067: "Cannot use java reflexion on "
068: + this .ejbClass.getName());
069: }
070: }
071: }
072:
073: /**
074: * Get the 'isModified' method name implemented in the bean class.
075: * (This information is JOnAS specific).
076: * @return Name of the isModified method
077: */
078: public Method getIsModifiedMethod() {
079: if (isModifiedMethod == null)
080: throw new Error("No isModified method defined for bean "
081: + this .ejbName);
082: return isModifiedMethod;
083: }
084:
085: /**
086: * Assessor for existence of a isModified methoe
087: * @return true of isModified method exist for the bean
088: */
089: public boolean hasIsModifiedMethod() {
090: return isModifiedMethod != null;
091: }
092:
093: /**
094: * String representation of the object for test purpose
095: * @return String representation of this object
096: */
097: public String toString() {
098: StringBuffer ret = new StringBuffer();
099: ret.append(super .toString());
100: if (hasIsModifiedMethod())
101: ret.append("getIsModifiedMethod()="
102: + getIsModifiedMethod().toString());
103: return ret.toString();
104: }
105:
106: }
|