1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs;
17
18 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
19 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
20 import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
21 import org.apache.geronimo.ews.ws4j2ee.toWs.UnrecoverableGenerationFault;
22 import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
23 import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.geronimo.InternalBasedWrapperClassWriter;
24 import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.geronimo.RemoteInterfacedBasedWrapperClassWriter4Geronimo;
25 import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.jboss.RemoteInterfacedBasedWrapperClassWriter4JBoss;
26 import org.apache.geronimo.ews.ws4j2ee.toWs.wrapperWs.jonas.RemoteInterfacedBasedWrapperClassWriter4JOnAS;
27
28 /***
29 * @author Srinath Perera(hemapani@opensource.lk)
30 */
31 public class WrapperClassGeneratorFactory {
32 public static Writer createInstance(J2EEWebServiceContext context) throws GenerationFault {
33 String implStyle = context.getMiscInfo().getImplStyle();
34 String container = context.getMiscInfo().getTargetJ2EEContainer();
35 if (!context.getMiscInfo().isImplwithEJB()) {
36 return new WebEndpointWrapperClassWriter(context);
37 } else if (GenerationConstants.USE_REMOTE.equals(implStyle)
38 || GenerationConstants.USE_LOCAL_AND_REMOTE.equals(implStyle)) {
39 if (GenerationConstants.JBOSS_CONTAINER.equals(container))
40 return new RemoteInterfacedBasedWrapperClassWriter4JBoss(context);
41 else if (GenerationConstants.GERONIMO_CONTAINER.equals(container))
42 return new RemoteInterfacedBasedWrapperClassWriter4Geronimo(context);
43 else if (GenerationConstants.JONAS_CONTAINER.equals(container))
44 return new RemoteInterfacedBasedWrapperClassWriter4JOnAS(context);
45 else
46 throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found");
47 } else if (GenerationConstants.USE_LOCAL.equals(implStyle)) {
48 return new SimpleLocalInterfaceBasedWrapperClassWriter(context);
49 } else if (GenerationConstants.USE_INTERNALS.equals(implStyle)) {
50 if (GenerationConstants.JBOSS_CONTAINER.equals(container)) {
51
52 throw new UnrecoverableGenerationFault("This combination not supported" + implStyle + "|" + container);
53 } else if (GenerationConstants.GERONIMO_CONTAINER.equals(container)) {
54 return new InternalBasedWrapperClassWriter(context);
55 } else if (GenerationConstants.JONAS_CONTAINER.equals(container))
56 throw new UnrecoverableGenerationFault("This combination not supported" + implStyle + "|" + container);
57 else
58 throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found");
59 }
60 throw new UnrecoverableGenerationFault("No proper Wrapper Class generator found for " + implStyle + "|" + container);
61 }
62 }