001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 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: * Initial Developer : Sauthier Guillaume
022: * --------------------------------------------------------------------------
023: * $Id: SSBPortComponentDesc.java 5044 2004-07-01 14:54:13Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_ws.deployment.api;
026:
027: import org.objectweb.jonas_ejb.deployment.api.SessionStatelessDesc;
028:
029: import org.objectweb.jonas_ws.deployment.xml.JonasPortComponent;
030: import org.objectweb.jonas_ws.deployment.xml.PortComponent;
031:
032: /**
033: * PortComponentDesc specialization for Session Bean exposed as WebServices.
034: * @author Guillaume Sauthier
035: */
036: public class SSBPortComponentDesc extends PortComponentDesc {
037:
038: /** linked to the StatelessSessionBean */
039: private SessionStatelessDesc ssDesc = null;
040:
041: /**
042: * Constructs a new SSBPortComponentDesc.
043: * @param cl module ClassLoader
044: * @param pc XML Element port-component
045: * @param jpc XML Element jonas-port-component
046: * @param parent ServiceDesc containing the PortComponent
047: * @throws WSDeploymentDescException When call to PortComponentDesc
048: * constructor fails.
049: */
050: SSBPortComponentDesc(ClassLoader cl, PortComponent pc,
051: JonasPortComponent jpc, ServiceDesc parent)
052: throws WSDeploymentDescException {
053:
054: super (cl, pc, jpc, parent);
055:
056: // set ServiceImplBean link from ejb-link element
057: setSibLink(pc.getServiceImplBean().getEjbLink());
058: }
059:
060: /**
061: * Return true if the Service Impl Bean is an EJB.
062: * @return true if the Service Impl Bean is an EJB.
063: */
064: public boolean hasBeanImpl() {
065: return true;
066: }
067:
068: /**
069: * Return true if the Service Impl Bean is a JaxRpc component.
070: * @return true if the Service Impl Bean is a JaxRpc component.
071: */
072: public boolean hasJaxRpcImpl() {
073: return false;
074: }
075:
076: /**
077: * Return the SessionStatelessDesc object linked with this
078: * portComponentDesc.
079: * @return the SessionStatelessDesc object linked with this
080: * portComponentDesc.
081: */
082: public SessionStatelessDesc getSessionStatelessDesc() {
083: return ssDesc;
084: }
085:
086: /**
087: * Set the beanDesc for this endpoint.
088: * @param bean The SSB Object declaring the endpoint.
089: */
090: public void setSessionStatelessDesc(SessionStatelessDesc bean) {
091: ssDesc = bean;
092: setSib(bean.getEjbClass().getName());
093: }
094:
095: /**
096: * Setter method for J2EE component linking.
097: * @param desc the descriptor of the component implementing the endpoint.
098: * @throws WSDeploymentDescException when desc is an unknown type.
099: */
100: public void setDesc(Object desc) throws WSDeploymentDescException {
101: if (desc instanceof SessionStatelessDesc) {
102: setSessionStatelessDesc((SessionStatelessDesc) desc);
103: } else {
104: throw new IllegalStateException(
105: getI18n()
106: .getMessage(
107: "SSBPortComponentDesc.illegalState", SessionStatelessDesc.class.getName())); //$NON-NLS-1$
108: }
109: }
110:
111: /**
112: * @return Returns a String representation of this SSBPortComponentDesc
113: */
114: public String toString() {
115: StringBuffer sb = new StringBuffer();
116:
117: sb.append(super .toString());
118: sb.append("\ngetSessionStatelessDesc().displayName="
119: + getSessionStatelessDesc());
120:
121: return sb.toString();
122: }
123: }
|