01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 1999 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * Initial Developer : Sauthier Guillaume
22: * --------------------------------------------------------------------------
23: * $Id: PortComponentDescFactory.java 5044 2004-07-01 14:54:13Z sauthieg $
24: * --------------------------------------------------------------------------
25: */package org.objectweb.jonas_ws.deployment.api;
26:
27: import org.objectweb.jonas_ws.deployment.xml.JonasPortComponent;
28: import org.objectweb.jonas_ws.deployment.xml.PortComponent;
29:
30: /**
31: * Factory used to create appropriate PortComponentDesc.<br>
32: * Choice is made in function of the port-component given as input parameter.<br>
33: * If service-impl-bean has a child called servlet-link,
34: * then a JaxRpcPortComponentDesc is created.<br>
35: * If service-impl-bean has a child called ejb-link,
36: * then a SSBPortComponentDesc is created.<br>
37: */
38: public class PortComponentDescFactory {
39:
40: /**
41: * Private empty constructor for utility class.
42: */
43: private PortComponentDescFactory() {
44: }
45:
46: /**
47: * Create a new PortComponentDesc instance.
48: *
49: * @param cl the ClassLoader used to load files (*.wsdl, mapping files, ...).
50: * @param pc the PortComponent object representing port-component XML element.
51: * @param jpc the JonasPortComponent object representing jonas-port-component XML element.
52: * @param parent container ServiceDesc
53: *
54: * @return the created PortComponentDesc
55: *
56: * @throws WSDeploymentDescException when instanciation fails.
57: */
58: public static PortComponentDesc newInstance(ClassLoader cl,
59: PortComponent pc, JonasPortComponent jpc, ServiceDesc parent)
60: throws WSDeploymentDescException {
61:
62: // EJB Case
63: if (pc.getServiceImplBean().getEjbLink() != null) {
64: return new SSBPortComponentDesc(cl, pc, jpc, parent);
65: } else { //WebApp case
66: return new JaxRpcPortComponentDesc(cl, pc, jpc, parent);
67: }
68: }
69: }
|