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 2002/01/28 16:30:22 UTC

cvs commit: xml-axis/java/src/javax/xml/rpc/soap SOAPHeaderFault.java SOAPFault.java

dims        02/01/28 07:30:22

  Modified:    java/src/javax/xml/rpc/soap SOAPFault.java
  Added:       java/src/javax/xml/rpc ServiceFactory.java
               java/src/javax/xml/rpc/server ServiceLifecycle.java
               java/src/javax/xml/rpc/soap SOAPHeaderFault.java
  Log:
  Adding a few classes from JAX-RPC 0.6 Spec.
  
  Revision  Changes    Path
  1.1                  xml-axis/java/src/javax/xml/rpc/ServiceFactory.java
  
  Index: ServiceFactory.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package javax.xml.rpc;
  
  import java.net.URL;
  
  import javax.xml.rpc.namespace.QName;
  
  /**
   * The javax.xml.rpc.ServiceFactory is an abstract class that provides
   * a factory for the creation of instances of the type
   * <code>javax.xml.rpc.Service</code>. This abstract class follows the
   * abstract static factory design pattern. This enables a J2SE based
   * client to create a Service instance in a portable manner without
   * using the constructor of the Service implementation class.
   */
  public abstract class ServiceFactory {
  
      /** */
      protected ServiceFactory() {}
  
      /**
       * Gets an instance of the ServiceFactory.
       * <p>Only one copy of a factory exists and is returned to the
       * application each time this method is called.
       * <p> The implementation class to be used can be overridden by
       * setting the javax.xml.rpc.ServiceFactory system property.
       * @return  ServiceFactory.
       * @throws  JAXRPCException
       */
      public static ServiceFactory newInstance() throws JAXRPCException {
          String factoryImplName =
              System.getProperty("javax.xml.rpc.ServiceFactory",
                                 "com.sun.xml.rpc.client.ServiceFactoryImpl");
          try {
              Class clazz = Class.forName(factoryImplName);
              return (ServiceFactory) clazz.newInstance();
          }
          catch (ClassNotFoundException e) {
              throw new JAXRPCException(e);
          }
          catch (IllegalAccessException e) {
              throw new JAXRPCException(e);
          }
          catch (InstantiationException e) {
              throw new JAXRPCException(e);
          }
      }
  
      /**
       *  Create a Service instance.
       *  @param   wsdlDocumentLocation URL for the WSDL document location
                                for the service
       *  @param   serviceName  QName for the service.
       *  @return  Service.
       *  @throws  JAXRPCException If any error in creation of the specified service
       */
      public abstract Service createService(URL wsdlDocumentLocation, QName serviceName)
          throws JAXRPCException;
  
      /**
       *  Create a Service instance.
       *  @param   serviceName QName for the service
       *  @return  Service.
       *  @throws  JAXRPCException If any error in creation of the specified service
       */
      public abstract Service createService(QName serviceName) throws JAXRPCException;
  }
  
  
  
  1.1                  xml-axis/java/src/javax/xml/rpc/server/ServiceLifecycle.java
  
  Index: ServiceLifecycle.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package javax.xml.rpc.server;
  
  import javax.xml.rpc.JAXRPCException;
  
  /**
   * The <code>javax.xml.rpc.server.ServiceLifecycle</code> defines
   * a lifecycle interface for servlet based JAX-RPC endpoint.
   */
  public interface ServiceLifecycle {
  
      /**
       * After a service endpoint object (an instance of a service
       * endpoint class) is instantiated, the JAX-RPC runtime system
       * invokes the init method.The service endpoint class uses the
       * init method to initialize its configuration and setup access
       * to any external resources.
       *  @param   context Initialization context for a JAX-RPC service
                   endpoint; Carries javax.servlet.ServletContext
                   for the servlet based JAX-RPC endpoints
       *  @throws  JAXRPCException If any error in initialization of the
                   service endpoint; or if any illegal context has
                   been provided in the init method
       */
      public abstract void init(Object context) throws JAXRPCException;
  
      /**
       * JAX-RPC runtime system ends the lifecycle of a service endpoint
       * object by invoking the destroy method. The service endpoint
       * releases its resourcesin the implementation of the destroy
       * method.
       */
      public abstract void destroy();
  }
  
  
  1.6       +94 -6     xml-axis/java/src/javax/xml/rpc/soap/SOAPFault.java
  
  Index: SOAPFault.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/javax/xml/rpc/soap/SOAPFault.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SOAPFault.java	30 Oct 2001 16:46:34 -0000	1.5
  +++ SOAPFault.java	28 Jan 2002 15:30:22 -0000	1.6
  @@ -54,14 +54,102 @@
    */
   package javax.xml.rpc.soap;
   
  -
  +import javax.xml.rpc.namespace.QName;
  +import javax.xml.soap.Detail;
   
   /**
  - * SOAPFault exception class is used for the mapping of the SOAP faults. If the use attribute in the soap:fault is 
  - * literal, the soap:fault maps to the SOAPFault exception. This class extends the exception class java.lang.Exception and is declared as a checked exception in the service definition interface. 
  - *
  - * @version 0.1
  + * SOAPFault exception class is used for the mapping of the
  + * SOAP faults. If the use attribute in the soap:fault is
  + * literal, the soap:fault maps to the SOAPFault exception.
  + * This class extends the exception class java.lang.Exception
  + * and is declared as a checked exception in the service
  + * definition interface.
    */
  -public class SOAPFault extends javax.xml.rpc.FaultException {}
  +public class SOAPFault extends Exception {
  +
  +    /**
  +     *  Constructor for SOAPFault
  +     *  <p>
  +     *  @param  faultcode    Qualified name of the faultcode
  +     *  @param  faultstring  The faultstring element of the SOAP fault
  +     *  @param  faultactor   faultactor element of the SOAP fault
  +     *  @param  detail       detail element of the SOAP fault
  +     */
  +    public SOAPFault(QName faultcode, String faultstring, String faultactor,
  +                     Detail detail) {
  +        super(faultstring);
  +        this.faultcode = faultcode;
  +        this.faultstring = faultstring;
  +        this.faultactor = faultactor;
  +        this.detail = detail;
  +    }
  +
  +    /**
  +     *  Sets the faultcode that provides an algorithmic mechanism
  +     *  for the identification of a SOAP fault.
  +     *  @param  faultcode  Qualified name of the faultcode
  +     */
  +    public void setFaultCode(QName faultcode) {
  +        this.faultcode = faultcode;
  +    }
  +
  +    /**
  +     *  Gets the faultcode element.
  +     *  @return  Qualified name of the faultcode element
  +     */
  +    public QName getFaultCode() {
  +        return faultcode;
  +    }
  +
  +    /**
  +     *  Sets the faultstring element.
  +     *  @param  faultstring  The faultstring element of the SOAP fault
  +     */
  +    public void setFaultString(String faultstring) {
  +        this.faultstring = faultstring;
  +    }
  +
  +    /**
  +     *  Gets the faultstring element.
  +     *  @return  faultstring element of the SOAP fault
  +     */
  +    public String getFaultString() {
  +        return faultstring;
  +    }
  +
  +    /**
  +     *  Sets the faultactor element.
  +     *  @param faultactor element of the SOAP fault
  +     */
  +    public void setFaultActor(String faultactor) {
  +        this.faultactor = faultactor;
  +    }
  +
  +    /**
  +     *  Gets the faultactor element.
  +     *  @return faultactor element of the SOAP fault
  +     */
  +    public String getFaultActor() {
  +        return faultactor;
  +    }
  +
  +    /**
  +     *  Gets the detail element.
  +     *  @return  detail element of the SOAP fault
  +     */
  +    public Detail getDetail() {
  +        return detail;
  +    }
  +
  +    /** Qualified name of the faultcode. */
  +    private QName faultcode;
  +
  +    /** The faultstring element of the SOAP fault */
  +    private String faultstring;
   
  +    /** faultactor element of the SOAP fault */
  +    private String faultactor;
   
  +    /** detail element of the SOAP fault */
  +    private Detail detail;
  +}
  
  
  
  1.1                  xml-axis/java/src/javax/xml/rpc/soap/SOAPHeaderFault.java
  
  Index: SOAPHeaderFault.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Axis" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package javax.xml.rpc.soap;
  
  import javax.xml.rpc.namespace.QName;
  
  /**
   *  The class javax.xml.rpc.soap.SOAPHeaderFault represents the
   *  mapping of SOAP Header fault as specified in soap:header element
   *  in the SOAP binding.
   */
  public class SOAPHeaderFault extends RuntimeException {
  
      /**
       *  Constructor for SOAPHeaderFault
       *  @param  faultcode    Qualified name of the faultcode
       *  @param  faultstring  The faultstring element of the SOAP fault
       *  @param  faultactor   faultactor element of the SOAP fault
       */
      public SOAPHeaderFault(QName faultcode, String faultstring,
                             String faultactor) {
          super(faultstring);
          this.faultcode = faultcode;
          this.faultstring = faultstring;
          this.faultactor = faultactor;
      }
  
      /**
       *  Sets the faultcode that provides an algorithmic mechanism
       *  for the identification of a SOAP fault.
       *  @param  faultcode  Qualified name of the faultcode
       */
      public void setFaultCode(QName faultcode) {
          this.faultcode = faultcode;
      }
  
      /**
       *  Gets the faultcode element.
       *  @return  Qualified name of the faultcode element
       */
      public QName getFaultCode() {
          return faultcode;
      }
  
      /**
       *  Sets the faultstring element.
       *  @param  faultstring  The faultstring element of the SOAP fault
       */
      public void setFaultString(String faultstring) {
          this.faultstring = faultstring;
      }
  
      /**
       *  Gets the faultstring element.
       *  @return  faultstring element of the SOAP fault
       */
      public String getFaultString() {
          return faultstring;
      }
  
      /**
       *  Sets the faultactor element.
       *  @param faultactor element of the SOAP fault
       */
      public void setFaultActor(String faultactor) {
          this.faultactor = faultactor;
      }
  
      /**
       *  Gets the faultactor element.
       *  @return faultactor element of the SOAP fault
       */
      public String getFaultActor() {
          return faultactor;
      }
  
      /** Qualified name of the faultcode. */
      private QName faultcode;
  
      /** The faultstring element of the SOAP fault */
      private String faultstring;
  
      /** faultactor element of the SOAP fault */
      private String faultactor;
  }