axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/utils resources.properties
Date Fri, 07 Dec 2001 23:39:22 GMT
gdaniels    01/12/07 15:39:22

  Modified:    java/src/org/apache/axis/client Service.java
               java/src/org/apache/axis/utils resources.properties
  Added:       java/src/org/apache/axis/client ServiceFactory.java
  Removed:     java/src/org/apache/axis/client AxisClientFactory.java
  Log:
  Revamp client-side JNDI usage.  Essentially we've removed the default
  usage of JNDI - now you only get it if you explicitly use a ServiceFactory
  to get a Service.  (we're scoping it at the Service level because that's the
  outermost object that a client will deal with - in fact, I'd like to discuss getting
  rid of the AxisClient public constructors at some point)
  
  If you just create a Service, it simply works with no JNDI.  So if you're in an
  EJB context, you need to know about it and make sure that you get a
  Service reference using the ServiceFactory or some custom JNDI code.
  
  This will be further improved by syncing closer with JAX-RPC/JSR109, but
  for now this cleans everything up and speeds up the default (non EJB)
  cases.
  
  ATTN SAM : this should move over to alpha-3.
  
  Revision  Changes    Path
  1.28      +17 -7     xml-axis/java/src/org/apache/axis/client/Service.java
  
  Index: Service.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- Service.java	2001/11/30 13:51:30	1.27
  +++ Service.java	2001/12/07 23:39:21	1.28
  @@ -102,7 +102,8 @@
       private Definition          wsdlDefinition = null ;
       private javax.wsdl.Service  wsdlService    = null ;
   
  -    private ConfigurationProvider configProvider = null;
  +    private ConfigurationProvider configProvider =
  +            new FileProvider(Constants.CLIENT_CONFIG_FILE);
   
       Definition getWSDLDefinition() {
           return( wsdlDefinition );
  @@ -114,12 +115,7 @@
   
       protected AxisClient getAxisClient() throws JAXRPCException
       {
  -        String name = "some name";
  -        try {
  -            return AxisClientFactory.getClient(name, configProvider);
  -        } catch (AxisFault fault) {
  -            throw new JAXRPCException(fault.getMessage());
  -        }
  +        return new AxisClient(configProvider);
       }
   
       /**
  @@ -423,5 +419,19 @@
        */
       public AxisEngine getEngine() {
           return( engine );
  +    }
  +
  +    /**
  +     * Set this Service's configuration provider.
  +     *
  +     * Note that since all of the constructors create the AxisClient right
  +     * now, this is basically a no-op.  Putting it in now so that we can make
  +     * lazy engine instantiation work, and not have to duplicate every single
  +     * Service constructor with a ConfigurationProvider argument.
  +     *
  +     * @param configProvider the ConfigurationProvider we want to use.
  +     */
  +    public void setConfigProvider(ConfigurationProvider configProvider) {
  +        this.configProvider = configProvider;
       }
   }
  
  
  
  1.1                  xml-axis/java/src/org/apache/axis/client/ServiceFactory.java
  
  Index: ServiceFactory.java
  ===================================================================
  package org.apache.axis.client;
  
  import org.apache.axis.ConfigurationProvider;
  import org.apache.axis.AxisFault;
  import org.apache.axis.Constants;
  import org.apache.axis.configuration.FileProvider;
  
  import javax.naming.InitialContext;
  import javax.naming.NamingException;
  import javax.xml.rpc.JAXRPCException;
  import java.util.Map;
  
  /**
   * Helper class for obtaining Services from JNDI.
   *
   * !!! WORK IN PROGRESS
   * 
   * @author Glen Daniels (gdaniels@macromedia.com)
   */ 
  
  public class ServiceFactory {
      private static FileProvider defaultConfigProvider =
                             new FileProvider(Constants.CLIENT_CONFIG_FILE);
  
      /**
       * Obtain an AxisClient reference, using JNDI if possible, otherwise
       * creating one using the standard Axis configuration pattern.  If we
       * end up creating one and do have JNDI access, bind it to the passed
       * name so we find it next time.
       *
       * @param name the JNDI name we're interested in
       * @param configProvider a ConfigurationProvider which should be used
       *                       to configure any engine we end up creating, or
       *                       null to use the default configuration pattern.
       */
      static public Service getService(Map environment)
          throws JAXRPCException
      {
          Service service = null;
          InitialContext context = null;
  
          ConfigurationProvider configProvider =
                  (ConfigurationProvider)environment.get("configProvider");
          if (configProvider == null)
              configProvider = defaultConfigProvider;
  
          // First check to see if JNDI works
          // !!! Might we need to set up context parameters here?
          try {
              context = new InitialContext();
          } catch (NamingException e) {
          }
          
          if (context != null) {
              String name = (String)environment.get("jndiName");
              if (name == null) {
                  name = "axisServiceName";
              }
  
              // We've got JNDI, so try to find an AxisClient at the
              // specified name.
              try {
                  service = (Service)context.lookup(name);
              } catch (NamingException e) {
                  service = new Service(configProvider);
                  try {
                      context.bind(name, service);
                  } catch (NamingException e1) {
                      // !!! Couldn't do it, what should we do here?
                  }
              }
          } else {
              service = new Service(configProvider);
          }
  
          return service;
      }
  }
  
  
  
  1.27      +2 -0      xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- resources.properties	2001/12/06 21:24:14	1.26
  +++ resources.properties	2001/12/07 23:39:21	1.27
  @@ -121,6 +121,7 @@
   done00=Done processing
   doQuit00=Doing a quit
   
  +dupConfigProvider00=Attempt to set configProvider for already-configured Service!
   duplicateFile00=Duplicate file name: {0}.  \nHint: you may have mapped two namespaces with
elements of the same name to the same package name.
   duplicateClass00=Duplicate class name: {0}.  \nHint: you may have mapped two namespaces
with elements of the same name to the same package name.
   
  @@ -326,6 +327,7 @@
   
   noPrefix00={0} did not find prefix:  {1}
   noPrincipal00=No principal!
  +noProviderAttr00=No provider specified for service ''{0}''
   noProviderElem00=The required provider element is missing
   noRecorder00=No event recorder inside element
   
  
  
  

Mime
View raw message