You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/01/21 18:50:53 UTC

cvs commit: ws-axis/java/src/org/apache/axis/configuration EngineConfigurationFactoryEJB.java EngineConfigurationFactoryDefault.java EngineConfigurationFactoryFinder.java

dims        2005/01/21 09:50:53

  Modified:    java/src/org/apache/axis/configuration
                        EngineConfigurationFactoryDefault.java
                        EngineConfigurationFactoryFinder.java
  Added:       java/src/org/apache/axis/configuration
                        EngineConfigurationFactoryEJB.java
  Log:
  Fix for AXIS-1776 - Client configuration '.wsdd' files not found when packaged in an ejb-jar file.
  from Andrei Iltchenko (andrei.iltchenko@nl.compuware.com)
  
  URL: http://issues.apache.org/jira/browse/AXIS-1776
  
  Revision  Changes    Path
  1.6       +2 -3      ws-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryDefault.java
  
  Index: EngineConfigurationFactoryDefault.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryDefault.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- EngineConfigurationFactoryDefault.java	25 Feb 2004 14:02:33 -0000	1.5
  +++ EngineConfigurationFactoryDefault.java	21 Jan 2005 17:50:53 -0000	1.6
  @@ -49,9 +49,8 @@
       protected static final String CLIENT_CONFIG_FILE = "client-config.wsdd";
       protected static final String SERVER_CONFIG_FILE = "server-config.wsdd";
   
  -    private String clientConfigFile;
  -
  -    private String serverConfigFile;
  +    protected String clientConfigFile;
  +    protected String serverConfigFile;
   
       /**
        * Creates and returns a new EngineConfigurationFactory.
  
  
  
  1.27      +1 -0      ws-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java
  
  Index: EngineConfigurationFactoryFinder.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryFinder.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- EngineConfigurationFactoryFinder.java	25 Feb 2004 14:02:33 -0000	1.26
  +++ EngineConfigurationFactoryFinder.java	21 Jan 2005 17:50:53 -0000	1.27
  @@ -64,6 +64,7 @@
           AxisProperties.setClassDefaults(EngineConfigurationFactory.class,
                               new String[] {
                                   "org.apache.axis.configuration.EngineConfigurationFactoryServlet",
  +                                "org.apache.axis.configuration.EngineConfigurationFactoryEJB",
                                   "org.apache.axis.configuration.EngineConfigurationFactoryDefault",
                                   });
       }
  
  
  
  1.1                  ws-axis/java/src/org/apache/axis/configuration/EngineConfigurationFactoryEJB.java
  
  Index: EngineConfigurationFactoryEJB.java
  ===================================================================
  /*
   * Copyright 2002-2005 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.configuration;
  
  import org.apache.axis.components.logger.LogFactory;
  import org.apache.axis.EngineConfigurationFactory;
  import org.apache.axis.EngineConfiguration;
  import org.apache.commons.logging.Log;
  
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.io.FileNotFoundException;
  
  
  /**
   * This is an implementation of {@link EngineConfigurationFactory} intended
   * for use when Axis is run from within an EJB container. It enables to find
   * a client configuration <tt>.wsdd</tt> file when it is packaged as part of an
   * ejb-jar file and the Application server uses distinct class loaders
   * per ejb-jar of a J2EE application.
   *
   * @author Andrei Iltchenko (andrei.iltchenko@nl.compuware.com)
   * @author Paulo Moreira    (paulo.moreira@nl.compuware.com)
   */
  public class  EngineConfigurationFactoryEJB
      extends EngineConfigurationFactoryDefault
  {
      protected static Log log =
          LogFactory.getLog(EngineConfigurationFactoryEJB.class.getName());
  
      /**
       * Creates and returns a new EngineConfigurationFactory.
       * If a factory cannot be created, returns the <code>null</code> reference.
       *
       * @param p   currently the constuctor argument is used only by the
       *            {@link EngineConfigurationFactoryServlet#newFactory(Object)}
       *            method where it must refer to
       *            a {@link javax.servlet.ServletConfig} object.
       *            In all other contexts (including calling this static factory
       *            method) the agrument is meaningless and shall hold the
       *            <code>null</code> reference.
       * @see org.apache.axis.configuration.EngineConfigurationFactoryFinder
       */
      public static EngineConfigurationFactory  newFactory(Object p) {
          return  p != null  ?  null : new EngineConfigurationFactoryEJB();
      }
  
      /**
       * Calls {@link EngineConfigurationFactoryDefault#EngineConfigurationFactoryDefault()}.
       * The constructor is defined merely to ensure that it is protected.
       */
      protected  EngineConfigurationFactoryEJB() {
      }
  
      public EngineConfiguration getClientEngineConfig() {
          InputStream   is;
          try {
              // Try to obtain directly from the file system.
              is = new FileInputStream(clientConfigFile);
          } catch (FileNotFoundException e) {
              // Try to obtain through the context class loader.
              is = Thread.currentThread().getContextClassLoader().
                      getResourceAsStream(clientConfigFile);
          }
          return  new FileProvider(is);
      }
  
  }  /*  For  Class   EngineConfigurationFactoryEJB   */