You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2004/10/25 17:27:49 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc RPCWebServiceGenarator.java

dicka       2004/10/25 08:27:49

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws WSDL2Ws.java
  Added:       c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        WebServiceGenerator.java
                        WebServiceGeneratorFactory.java
                        WebServiceGeneratorImpl.java
  Removed:     c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        WebServiceGenarator.java
                        WebServiceGenaratorFactory.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/doclit
                        DocLitWebServiceGenarator.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc
                        RPCWebServiceGenarator.java
  Log:
  Consolidate duplication of DocLitWebServiceGenarator and RPCWebServiceGenarator into WebServiceGeneratorImpl.
  
  Additionally, corrected a number of spelling mistakes in Class and Method names, and documentation.
  
  Submitted by: Adrian Dick
  
  Revision  Changes    Path
  1.43      +3 -3      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
  
  Index: WSDL2Ws.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- WSDL2Ws.java	25 Oct 2004 13:44:13 -0000	1.42
  +++ WSDL2Ws.java	25 Oct 2004 15:27:49 -0000	1.43
  @@ -476,8 +476,8 @@
           
           //TODO	chaeck weather the name at the WrapperConstant Doclit is right "doc"
   
  -        WebServiceGenarator wsg =
  -            WebServiceGenaratorFactory.createWebServiceGenarator(
  +        WebServiceGenerator wsg =
  +            WebServiceGeneratorFactory.createWebServiceGenerator(
                   new WebServiceContext(
                       new WrapperInfo(
                           serviceStyle,
  @@ -499,7 +499,7 @@
           		System.out.println(it.next());
           	}
           }    
  - 		wsg.genarate();
  + 		wsg.generate();
       }
       
       /**
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGenerator.java
  
  Index: WebServiceGenerator.java
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
  
  package org.apache.axis.wsdl.wsdl2ws;
  
  /**
   * Abstract webservice Generator
   * @author Srinath Perera (hemapani@opensource.lk)
   * @author Dimuthu Leelarathne (muthulee@opensource.lk)
   */
  public interface WebServiceGenerator
  {
      public void generate() throws WrapperFault;
  }
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorFactory.java
  
  Index: WebServiceGeneratorFactory.java
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
  
  package org.apache.axis.wsdl.wsdl2ws;
  
  import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  /**
   * Create the concreate WebService Generator, depends on the options.
   * @author Srinath Perera (hemapani@opensource.lk)
   * @author Dimuthu Leelarathne (muthulee@opensource.lk)
   */
  public class WebServiceGeneratorFactory
  {
      public static WebServiceGenerator createWebServiceGenerator(WebServiceContext wscontext)
      {
          if (wscontext.getWrapInfo().getWrapperStyle()
              == WrapperConstants.STYLE_RPC)
          {
              return new WebServiceGeneratorImpl(wscontext);
          }
          else
          {
              if (wscontext.getWrapInfo().getWrapperStyle()
                  == WrapperConstants.STYLE_DOCUMENT)
              {
                  return new WebServiceGeneratorImpl(wscontext);
              }
              else
              {
                  return null;
              }
          }
      }
  }
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WebServiceGeneratorImpl.java
  
  Index: WebServiceGeneratorImpl.java
  ===================================================================
  /*
   *   Copyright 2003-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   */
  
  /**
   * @author Srinath Perera(hemapani
   */
  
  package org.apache.axis.wsdl.wsdl2ws;
  
  import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  
  public class WebServiceGeneratorImpl implements WebServiceGenerator
  {
      private WebServiceContext wscontext;
      public WebServiceGeneratorImpl(WebServiceContext wscontext)
      {
          this.wscontext = wscontext;
      }
  
      /**
       * Generate the wrapper generator, Service generator,Param Generator and call
       * Generate on them.
       * @see org.apache.axis.wsdl.wsdl2ws.WebServiceGenerator#generate()
       */
      public void generate() throws WrapperFault
      {
          String language = wscontext.getWrapInfo().getWrapperLanguage();
  
          if (WrapperConstants.LANGUAGE_JAVA.equalsIgnoreCase(language))
          {
              (new Genarator(WrapperConstants.GENERATOR_WRAPPER_JAVA, wscontext))
                  .genarate();
              (new Genarator(WrapperConstants.GENERATOR_SERVICE_JAVA, wscontext))
                  .genarate();
              (new Genarator(WrapperConstants.GENERATOR_PARAM_JAVA, wscontext))
                  .genarate();
          }
          else
          {
  
              if (WrapperConstants.LANGUAGE_CPP.equalsIgnoreCase(language))
              {
                  if (WrapperConstants
                      .SERVER
                      .equals(wscontext.getWrapInfo().getTargetEngine()))
                  {
                      (new Genarator(WrapperConstants.GENERATOR_WRAPPER_CPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_WRAPPER_HPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_SERVICE_CPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_SERVICE_HPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_PARAM_CPP_ALL,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_CPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_SERVER_EXCEPTION,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT,
                          wscontext))
                          .genarate();
                      /*
                       * Ensure the BuildScript generator is called last.
                       * If called earlier not all files will be added
                       * to the build script (Ex: to Makefile.am).
                       */
                      (new Genarator(WrapperConstants.GENERATOR_BUILDSCRIPT,
                          wscontext))
                          .genarate();
                  }
                  else
                  {
                      (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_CPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_HPP,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_CLIENT_EXCEPTION,
                          wscontext))
                          .genarate();
                      (new Genarator(WrapperConstants.GENERATOR_PARAM_CPP_ALL,
                          wscontext))
                          .genarate();
                      /*
                       * Ensure the BuildScript generator is called last.
                       * If called earlier not all files will be added
                       * to the build script (Ex: to Makefile.am).
                       */
                      (new Genarator(WrapperConstants.GENERATOR_BUILDSCRIPT,
                          wscontext))
                          .genarate();
                  }
              }
              else
              {
  
                  if (WrapperConstants.LANGUAGE_C.equalsIgnoreCase(language))
                  {
                      if (WrapperConstants
                          .SERVER
                          .equals(wscontext.getWrapInfo().getTargetEngine()))
                      {
                          (new Genarator(WrapperConstants.GENERATOR_WRAPPER_C,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_WRAPPER_H,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_SERVICE_C,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_PARAM_C_ALL,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_C,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT,
                              wscontext))
                              .genarate();
                          /*
                           * Ensure the BuildScript generator is called last.
                           * If called earlier not all files will be added
                           * to the build script (Ex: to Makefile.am).
                           */
                          (new Genarator(WrapperConstants.GENERATOR_BUILDSCRIPT,
                              wscontext))
                              .genarate();
                      }
                      else
                      {
                          (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_C,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_H,
                              wscontext))
                              .genarate();
                          (new Genarator(WrapperConstants.GENERATOR_PARAM_C_ALL,
                              wscontext))
                              .genarate();
                          /*
                           * Ensure the BuildScript generator is called last.
                           * If called earlier not all files will be added
                           * to the build script (Ex: to Makefile.am).
                           */
                          (new Genarator(WrapperConstants.GENERATOR_BUILDSCRIPT,
                              wscontext))
                              .genarate();
                      }
                  }
                  else
                  {
                      throw new WrapperFault("Unsupported Language" + language);
                  }
              }
          }
      }
  }