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  package org.apache.geronimo.ews.ws4j2ee.toWs.dd;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
21  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationConstants;
22  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
23  import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
24  import org.apache.geronimo.ews.ws4j2ee.toWs.Writer;
25  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.geronimo.GeronimoDDWriter;
26  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.jboss.JBossDDWriter;
27  import org.apache.geronimo.ews.ws4j2ee.toWs.dd.jonas.JOnASDDWriter;
28  
29  /***
30   * @author Srinath perera(hemapani@opesnource.lk)
31   */
32  public class J2EEContainerSpecificDDGenerator implements Generator {
33      private J2EEWebServiceContext j2eewscontext;
34      private Writer writer;
35      protected static Log log =
36              LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
37  
38      public J2EEContainerSpecificDDGenerator(J2EEWebServiceContext j2eewscontext) throws GenerationFault {
39          this.j2eewscontext = j2eewscontext;
40          if (GenerationConstants.JBOSS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
41              writer = new JBossDDWriter(j2eewscontext);
42          else if (GenerationConstants.JONAS_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
43              writer = new JOnASDDWriter(j2eewscontext);
44          else if (GenerationConstants.GERONIMO_CONTAINER.equals(j2eewscontext.getMiscInfo().getTargetJ2EEContainer()))
45              writer = new GeronimoDDWriter(j2eewscontext);
46          else
47              new GenerationFault("unsupported j2ee container " + j2eewscontext.getMiscInfo().getTargetJ2EEContainer());
48      }
49  
50      public void generate() throws GenerationFault {
51          if (writer != null)
52              writer.write();
53      }
54  }