KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ws > deployment > api > PortComponentDescFactory


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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,v 1.5 2004/07/01 14:54:12 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26 package org.objectweb.jonas_ws.deployment.api;
27
28 import org.objectweb.jonas_ws.deployment.xml.JonasPortComponent;
29 import org.objectweb.jonas_ws.deployment.xml.PortComponent;
30
31
32 /**
33  * Factory used to create appropriate PortComponentDesc.<br>
34  * Choice is made in function of the port-component given as input parameter.<br>
35  * If service-impl-bean has a child called servlet-link,
36  * then a JaxRpcPortComponentDesc is created.<br>
37  * If service-impl-bean has a child called ejb-link,
38  * then a SSBPortComponentDesc is created.<br>
39  */

40 public class PortComponentDescFactory {
41
42     /**
43      * Private empty constructor for utility class.
44      */

45     private PortComponentDescFactory() { }
46
47     /**
48      * Create a new PortComponentDesc instance.
49      *
50      * @param cl the ClassLoader used to load files (*.wsdl, mapping files, ...).
51      * @param pc the PortComponent object representing port-component XML element.
52      * @param jpc the JonasPortComponent object representing jonas-port-component XML element.
53      * @param parent container ServiceDesc
54      *
55      * @return the created PortComponentDesc
56      *
57      * @throws WSDeploymentDescException when instanciation fails.
58      */

59     public static PortComponentDesc newInstance(ClassLoader JavaDoc cl,
60                                                 PortComponent pc,
61                                                 JonasPortComponent jpc,
62                                                 ServiceDesc parent)
63         throws WSDeploymentDescException {
64
65         // EJB Case
66
if (pc.getServiceImplBean().getEjbLink() != null) {
67             return new SSBPortComponentDesc(cl, pc, jpc, parent);
68         } else { //WebApp case
69
return new JaxRpcPortComponentDesc(cl, pc, jpc, parent);
70         }
71     }
72 }
73
Popular Tags