View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.geronimo.ews.ws4j2ee.toWs.impl;
18  
19  import org.apache.axis.wsdl.fromJava.Emitter;
20  import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
21  import org.apache.geronimo.ews.ws4j2ee.context.j2eeDD.EJBContext;
22  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
23  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
24  import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
25  import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
26  import org.apache.geronimo.ews.ws4j2ee.toWs.Ws4J2eeDeployContext;
27  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.J2EEContainerSpecificDDGenerator;
28  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.JaxrpcMapperGenerator;
29  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.WebContainerDDGenerator;
30  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBDDWriter;
31  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBGenerator;
32  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBHomeWriter;
33  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBLocalHomeWriter;
34  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.EJBRemoteWriter;
35  import org.apache.geronimo.ews.ws4j2ee.toWs.ejb.SessionBeanWriter;
36  import org.apache.geronimo.ews.ws4j2ee.toWs.handlers.HandlerGenerator;
37  import org.apache.geronimo.ews.ws4j2ee.toWs.misc.BuildFileConfigurer;
38  import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.WrapperWsGenerator;
39  import org.apache.geronimo.ews.ws4j2ee.toWs.ws.ClientSideWsGenerator;
40  import org.apache.geronimo.ews.ws4j2ee.toWs.ws.ServerSideWsGenerator;
41  import org.apache.geronimo.ews.ws4j2ee.toWs.wsdl.WSDLGenerator;
42  
43  /***
44   * @author hemapani@opensource.lk
45   */
46  public class GenerationFactoryImpl
47          implements org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFactory {
48      public Writer createEJBWriter(J2EEWebServiceContext j2eewscontext,
49                                    EJBContext ejbcontext,
50                                    int writerType)
51              throws GenerationFault {
52          if (GenerationConstants.EJB_DD_WRITER == writerType)
53              return new EJBDDWriter(j2eewscontext, ejbcontext);
54          else if (GenerationConstants.EJB_HOME_INTERFACE_WRITER == writerType)
55              return new EJBHomeWriter(j2eewscontext, ejbcontext);
56          else if (GenerationConstants.EJB_REMOTE_INTERFACE_WRITER == writerType)
57              return new EJBRemoteWriter(j2eewscontext, ejbcontext);
58          else if (
59                  GenerationConstants.EJB_LOCAL_HOME_INTERFACE_WRITER == writerType)
60              return new EJBLocalHomeWriter(j2eewscontext, ejbcontext);
61          else if (GenerationConstants.EJB_LOCAL_INTERFACE_WRITER == writerType)
62              return new EJBLocalHomeWriter(j2eewscontext, ejbcontext);
63          else if (
64                  GenerationConstants.EJB_IMPLEMENTATION_BEAN_WRITER == writerType)
65              return new SessionBeanWriter(j2eewscontext, ejbcontext);
66          else
67              throw new GenerationFault("the writer not found");
68      }
69  
70      public Generator createEJBGenerator(J2EEWebServiceContext j2eewscontext)
71              throws GenerationFault {
72          return new EJBGenerator(j2eewscontext);
73      }
74  
75      public Generator createWrapperWsGenerator(J2EEWebServiceContext j2eewscontext)
76              throws GenerationFault {
77          return new WrapperWsGenerator(j2eewscontext);
78      }
79  
80      public Generator createClientSideWsGenerator(J2EEWebServiceContext j2eewscontext)
81              throws GenerationFault {
82          return new ClientSideWsGenerator(j2eewscontext);
83      }
84  
85      public Generator createWSDLGenerator(J2EEWebServiceContext wscontext,
86                                           Emitter emitter,
87                                           Ws4J2eeDeployContext clparser)
88              throws GenerationFault {
89          return new WSDLGenerator(wscontext, emitter, clparser);
90      }
91  
92      public Generator createServerSideWsGenerator(J2EEWebServiceContext j2eewscontext)
93              throws GenerationFault {
94          return new ServerSideWsGenerator(j2eewscontext);
95      }
96  
97      public Generator createHandlerGenerator(J2EEWebServiceContext j2eewscontext)
98              throws GenerationFault {
99          return new HandlerGenerator(j2eewscontext);
100     }
101 
102     public Generator createJaxrpcMapperGenerator(J2EEWebServiceContext j2eewscontext)
103             throws GenerationFault {
104         return new JaxrpcMapperGenerator(j2eewscontext);
105     }
106 
107     public Generator createContainerSpecificDDGenerator(J2EEWebServiceContext j2eewscontext)
108             throws GenerationFault {
109         return new J2EEContainerSpecificDDGenerator(j2eewscontext);
110     }
111 
112     public Generator createBuildFileGenerator(J2EEWebServiceContext j2eewscontext)
113             throws GenerationFault {
114         return new BuildFileConfigurer(j2eewscontext);
115     }
116 
117     public Generator createWebContainerDDGenerator(J2EEWebServiceContext j2eewscontext)
118             throws GenerationFault {
119         return new WebContainerDDGenerator(j2eewscontext);
120     }
121 
122 }