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.dd;
18  
19  import org.apache.axis.wsdl.Java2WSDL;
20  import org.apache.axis.wsdl.fromJava.Emitter;
21  import org.apache.commons.logging.Log;
22  import org.apache.commons.logging.LogFactory;
23  import org.apache.geronimo.ews.ws4j2ee.context.InputOutputFile;
24  import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
25  import org.apache.geronimo.ews.ws4j2ee.toWs.GenerationFault;
26  import org.apache.geronimo.ews.ws4j2ee.toWs.Generator;
27  
28  import java.io.OutputStreamWriter;
29  import java.io.PrintWriter;
30  
31  /***
32   * <p>This genarated theWrapper WS required in the
33   * Axis.</p>
34   *
35   * @author Srinath Perera(hemapani@opensource.lk)
36   */
37  public class JaxrpcMapperGenerator extends Java2WSDL implements Generator {
38      private J2EEWebServiceContext j2eewscontext;
39  
40      protected static Log log =
41              LogFactory.getLog(JaxrpcMapperGenerator.class.getName());
42  
43      public JaxrpcMapperGenerator(J2EEWebServiceContext j2eewscontext) {
44          this.j2eewscontext = j2eewscontext;
45      }
46  
47      public void generate() throws GenerationFault {
48          InputOutputFile outfile = j2eewscontext.getMiscInfo().getJaxrpcfile();
49          PrintWriter pw =
50                  new PrintWriter(new OutputStreamWriter(outfile.getOutStream()));
51          this.j2eewscontext.getJAXRPCMappingContext().serialize(pw);
52          pw.close();
53          if (j2eewscontext.getMiscInfo().isVerbose())
54              log.info(outfile.fileName() + " genarated .................");
55      }
56  
57      public Emitter getEmmiter() {
58          return emitter;
59      }
60  
61  }