dblevins    2004/12/22 00:42:40

  Added:       modules/openejb-builder/src/java/org/openejb/dd/webservices
                        Handler.java PortComponent.java
                        ServiceImplBean.java WebServiceDescription.java
                        WebServices.java WebServicesFactory.java
                        webservices_1_1.xml
  Log:

  Basic soap rpc/encoded deployment and container support along with a general 
revamping of the networkservice stacks.
  
  Revision  Changes    Path
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/Handler.java
  
  Index: Handler.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: Handler.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  import java.util.ArrayList;
  
  public class Handler {
      private String handlerName;
      private String handlerClass;
      private ArrayList soapHeaderList = new ArrayList();
      private ArrayList soapRoleList = new ArrayList();
  
      public String getHandlerName() {
          return handlerName;
      }
  
      public void setHandlerName(String handlerName) {
          this.handlerName = handlerName;
      }
  
      public String getHandlerClass() {
          return handlerClass;
      }
  
      public void setHandlerClass(String handlerClass) {
          this.handlerClass = handlerClass;
      }
  
  
      public void addSoapHeader(String soapHeader) throws 
IndexOutOfBoundsException {
          soapHeaderList.add(soapHeader);
      }
  
      public void addSoapHeader(int index, String soapHeader) throws 
IndexOutOfBoundsException {
          soapHeaderList.add(index, soapHeader);
      }
  
      public boolean removeSoapHeader(String soapHeader) {
          return soapHeaderList.remove(soapHeader);
      }
  
      public String getSoapHeader(int index) throws IndexOutOfBoundsException {
          if ((index < 0) || (index > soapHeaderList.size())) {
              throw new IndexOutOfBoundsException();
          }
          return (String) soapHeaderList.get(index);
      }
  
      public String[] getSoapHeader() {
          int size = soapHeaderList.size();
          String[] mArray = new String[size];
          for (int index = 0; index < size; index++) {
              mArray[index] = (String) soapHeaderList.get(index);
          }
          return mArray;
      }
  
      public void setSoapHeader(int index, String soapHeader) throws 
IndexOutOfBoundsException {
          if ((index < 0) || (index > soapHeaderList.size())) {
              throw new IndexOutOfBoundsException();
          }
          soapHeaderList.set(index, soapHeader);
      }
  
      public void setSoapHeader(String[] soapHeaderArray) {
          soapHeaderList.clear();
          for (int i = 0; i < soapHeaderArray.length; i++) {
              String soapHeader = soapHeaderArray[i];
              soapHeaderList.add(soapHeader);
          }
      }
  
      public void clearSoapHeader() {
          soapHeaderList.clear();
      }
  
  
      public void addSoapRole(String soapRole) throws IndexOutOfBoundsException 
{
          soapRoleList.add(soapRole);
      }
  
      public void addSoapRole(int index, String soapRole) throws 
IndexOutOfBoundsException {
          soapRoleList.add(index, soapRole);
      }
  
      public boolean removeSoapRole(String soapRole) {
          return soapRoleList.remove(soapRole);
      }
  
      public String getSoapRole(int index) throws IndexOutOfBoundsException {
          if ((index < 0) || (index > soapRoleList.size())) {
              throw new IndexOutOfBoundsException();
          }
          return (String) soapRoleList.get(index);
      }
  
      public String[] getSoapRole() {
          int size = soapRoleList.size();
          String[] mArray = new String[size];
          for (int index = 0; index < size; index++) {
              mArray[index] = (String) soapRoleList.get(index);
          }
          return mArray;
      }
  
      public void setSoapRole(int index, String soapRole) throws 
IndexOutOfBoundsException {
          if ((index < 0) || (index > soapRoleList.size())) {
              throw new IndexOutOfBoundsException();
          }
          soapRoleList.set(index, soapRole);
      }
  
      public void setSoapRole(String[] soapRoleArray) {
          soapRoleList.clear();
          for (int i = 0; i < soapRoleArray.length; i++) {
              String soapRole = soapRoleArray[i];
              soapRoleList.add(soapRole);
          }
      }
  
      public void clearSoapRole() {
          soapRoleList.clear();
      }
  
  
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/PortComponent.java
  
  Index: PortComponent.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: PortComponent.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  public class PortComponent {
      private String portComponentName;
      private String wsdlPort;
      private String serviceEndpointInterface;
      private ServiceImplBean serviceImplBean;
  
      /**
       * List of Handler objects
       *
       * @see org.openejb.dd.webservices.Handler
       */
      private ArrayList handlerList = new ArrayList();
      /**
       * Map of Handler objects indexed by handlerName
       *
       * @see org.openejb.dd.webservices.Handler#getHandlerName
       */
      private HashMap handlerMap = new HashMap();
  
      public void addHandler(Handler handler) throws IndexOutOfBoundsException {
          handlerList.add(handler);
          handlerMap.put(handler.getHandlerName(), handler);
      }
  
      public void addHandler(int index, Handler handler) throws 
IndexOutOfBoundsException {
          handlerList.add(index, handler);
          handlerMap.put(handler.getHandlerName(), handler);
      }
  
      public boolean removeHandler(Handler handler) {
          handlerMap.remove(handler.getHandlerName());
          return handlerList.remove(handler);
      }
  
      public Handler getHandler(int index) throws IndexOutOfBoundsException {
          if ((index < 0) || (index > handlerList.size())) {
              throw new IndexOutOfBoundsException();
          }
          return (Handler) handlerList.get(index);
      }
  
      public Handler[] getHandler() {
          int size = handlerList.size();
          Handler[] mArray = new Handler[size];
          for (int index = 0; index < size; index++) {
              mArray[index] = (Handler) handlerList.get(index);
          }
          return mArray;
      }
  
      public Handler getHandler(String handlerName) {
          return (Handler) handlerMap.get(handlerName);
      }
  
      public void setHandler(int index, Handler handler) throws 
IndexOutOfBoundsException {
          if ((index < 0) || (index > handlerList.size())) {
              throw new IndexOutOfBoundsException();
          }
          Handler removed = (Handler) handlerList.set(index, handler);
          handlerMap.remove(removed.getHandlerName());
          handlerMap.put(handler.getHandlerName(), handler);
      }
  
      public void setHandler(Handler[] handlerArray) {
          handlerList.clear();
          for (int i = 0; i < handlerArray.length; i++) {
              Handler handler = handlerArray[i];
              handlerList.add(handler);
              handlerMap.put(handler.getHandlerName(), handler);
          }
      }
  
      public void clearHandler() {
          handlerList.clear();
          handlerMap.clear();
      }
  
      public String getPortComponentName() {
          return portComponentName;
      }
  
      public void setPortComponentName(String portComponentName) {
          this.portComponentName = portComponentName;
      }
  
      public String getWsdlPort() {
          return wsdlPort;
      }
  
      public void setWsdlPort(String wsdlPort) {
          this.wsdlPort = wsdlPort;
      }
  
      public String getServiceEndpointInterface() {
          return serviceEndpointInterface;
      }
  
      public void setServiceEndpointInterface(String serviceEndpointInterface) {
          this.serviceEndpointInterface = serviceEndpointInterface;
      }
  
      public ServiceImplBean getServiceImplBean() {
          return serviceImplBean;
      }
  
      public void setServiceImplBean(ServiceImplBean serviceImplBean) {
          this.serviceImplBean = serviceImplBean;
      }
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/ServiceImplBean.java
  
  Index: ServiceImplBean.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: ServiceImplBean.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  public class ServiceImplBean {
      private String serlvetLink;
      private String ejbLink;
  
      public String getSerlvetLink() {
          return serlvetLink;
      }
  
      public void setSerlvetLink(String serlvetLink) {
          this.serlvetLink = serlvetLink;
      }
  
      public String getEjbLink() {
          return ejbLink;
      }
  
      public void setEjbLink(String ejbLink) {
          this.ejbLink = ejbLink;
      }
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/WebServiceDescription.java
  
  Index: WebServiceDescription.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: WebServiceDescription.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.openejb.dd.webservices.PortComponent;
  
  public class WebServiceDescription {
      private String webServiceDescriptionName;
      private String wsdlFile;
      private String jaxrpcMappingFile;
  
      /**
       * List of PortComponent objects
       *
       * @see org.openejb.dd.webservices.PortComponent
       */
      private ArrayList portComponentList = new ArrayList();
      /**
       * Map of PortComponent objects indexed by portComponentName
       *
       * @see org.openejb.dd.webservices.PortComponent#getPortComponentName
       */
      private HashMap portComponentMap = new HashMap();
  
      public String getWebServiceDescriptionName() {
          return webServiceDescriptionName;
      }
  
      public void setWebServiceDescriptionName(String 
webServiceDescriptionName) {
          this.webServiceDescriptionName = webServiceDescriptionName;
      }
  
      public String getWsdlFile() {
          return wsdlFile;
      }
  
      public void setWsdlFile(String wsdlFile) {
          this.wsdlFile = wsdlFile;
      }
  
      public String getJaxrpcMappingFile() {
          return jaxrpcMappingFile;
      }
  
      public void setJaxrpcMappingFile(String jaxrpcMappingFile) {
          this.jaxrpcMappingFile = jaxrpcMappingFile;
      }
  
      public void addPortComponent(PortComponent portComponent) throws 
IndexOutOfBoundsException {
          portComponentList.add(portComponent);
          portComponentMap.put(portComponent.getPortComponentName(), 
portComponent);
      }
  
      public void addPortComponent(int index, PortComponent portComponent) 
throws IndexOutOfBoundsException {
          portComponentList.add(index, portComponent);
          portComponentMap.put(portComponent.getPortComponentName(), 
portComponent);
      }
  
      public boolean removePortComponent(PortComponent portComponent) {
          portComponentMap.remove(portComponent.getPortComponentName());
          return portComponentList.remove(portComponent);
      }
  
      public PortComponent getPortComponent(int index) throws 
IndexOutOfBoundsException {
          if ((index < 0) || (index > portComponentList.size())) {
              throw new IndexOutOfBoundsException();
          }
          return (PortComponent) portComponentList.get(index);
      }
  
      public PortComponent[] getPortComponent() {
          int size = portComponentList.size();
          PortComponent[] mArray = new PortComponent[size];
          for (int index = 0; index < size; index++) {
              mArray[index] = (PortComponent) portComponentList.get(index);
          }
          return mArray;
      }
  
      public PortComponent getPortComponent(String portComponentName) {
          return (PortComponent) portComponentMap.get(portComponentName);
      }
  
      public void setPortComponent(int index, PortComponent portComponent) 
throws IndexOutOfBoundsException {
          if ((index < 0) || (index > portComponentList.size())) {
              throw new IndexOutOfBoundsException();
          }
          PortComponent removed = (PortComponent) portComponentList.set(index, 
portComponent);
          portComponentMap.remove(removed.getPortComponentName());
          portComponentMap.put(portComponent.getPortComponentName(), 
portComponent);
      }
  
      public void setPortComponent(PortComponent[] portComponentArray) {
          portComponentList.clear();
          for (int i = 0; i < portComponentArray.length; i++) {
              PortComponent portComponent = portComponentArray[i];
              portComponentList.add(portComponent);
              portComponentMap.put(portComponent.getPortComponentName(), 
portComponent);
          }
      }
  
      public void clearPortComponent() {
          portComponentList.clear();
          portComponentMap.clear();
      }
  
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/WebServices.java
  
  Index: WebServices.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: WebServices.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  
  import org.openejb.dd.webservices.WebServiceDescription;
  
  /**
   * A dtd version of the J2EE webservices.xml file would look like this:
   * <p/>
   * webservices (webservice-description+)
   * webservice-description (webservice-description-name, wsdl-file, 
jaxrpc-mapping-file, port-component+)
   * port-component (port-component-name, wsdl-port, 
service-endpoint-interface, service-impl-bean, handler*)
   * service-impl-bean (ejb-link|servlet-link)
   * handler (handler-name, handler-class, init-param*, soap-header*, 
soap-role*)
   */
  public class WebServices {
      /**
       * List of WebServiceDescription objects
       *
       * @see org.openejb.dd.webservices.WebServiceDescription
       */
      private ArrayList webServiceDescriptionList = new ArrayList();
      /**
       * Map of WebServiceDescription objects indexed by 
webServiceDescriptionName
       *
       * @see 
org.openejb.dd.webservices.WebServiceDescription#getWebServiceDescriptionName
       */
      private HashMap webServiceDescriptionMap = new HashMap();
  
      public void addWebServiceDescription(WebServiceDescription 
webServiceDescription) throws IndexOutOfBoundsException {
          webServiceDescriptionList.add(webServiceDescription);
          
webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(),
 webServiceDescription);
      }
  
      public void addWebServiceDescription(int index, WebServiceDescription 
webServiceDescription) throws IndexOutOfBoundsException {
          webServiceDescriptionList.add(index, webServiceDescription);
          
webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(),
 webServiceDescription);
      }
  
      public boolean removeWebServiceDescription(WebServiceDescription 
webServiceDescription) {
          
webServiceDescriptionMap.remove(webServiceDescription.getWebServiceDescriptionName());
          return webServiceDescriptionList.remove(webServiceDescription);
      }
  
      public WebServiceDescription getWebServiceDescription(int index) throws 
IndexOutOfBoundsException {
          if ((index < 0) || (index > webServiceDescriptionList.size())) {
              throw new IndexOutOfBoundsException();
          }
          return (WebServiceDescription) webServiceDescriptionList.get(index);
      }
  
      public WebServiceDescription[] getWebServiceDescription() {
          int size = webServiceDescriptionList.size();
          WebServiceDescription[] mArray = new WebServiceDescription[size];
          for (int index = 0; index < size; index++) {
              mArray[index] = (WebServiceDescription) 
webServiceDescriptionList.get(index);
          }
          return mArray;
      }
  
      public WebServiceDescription getWebServiceDescription(String 
webServiceDescriptionName) {
          return (WebServiceDescription) 
webServiceDescriptionMap.get(webServiceDescriptionName);
      }
  
      public void setWebServiceDescription(int index, WebServiceDescription 
webServiceDescription) throws IndexOutOfBoundsException {
          if ((index < 0) || (index > webServiceDescriptionList.size())) {
              throw new IndexOutOfBoundsException();
          }
          WebServiceDescription removed = (WebServiceDescription) 
webServiceDescriptionList.set(index, webServiceDescription);
          
webServiceDescriptionMap.remove(removed.getWebServiceDescriptionName());
          
webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(),
 webServiceDescription);
      }
  
      public void setWebServiceDescription(WebServiceDescription[] 
webServiceDescriptionArray) {
          clearWebServiceDescription();
          for (int i = 0; i < webServiceDescriptionArray.length; i++) {
              WebServiceDescription webServiceDescription = 
webServiceDescriptionArray[i];
              webServiceDescriptionList.add(webServiceDescription);
              
webServiceDescriptionMap.put(webServiceDescription.getWebServiceDescriptionName(),
 webServiceDescription);
          }
      }
  
      public void clearWebServiceDescription() {
          webServiceDescriptionList.clear();
          webServiceDescriptionMap.clear();
      }
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/WebServicesFactory.java
  
  Index: WebServicesFactory.java
  ===================================================================
  /**
   * Redistribution and use of this software and associated documentation
   * ("Software"), with or without modification, are permitted provided
   * that the following conditions are met:
   *
   * 1. Redistributions of source code must retain copyright
   *    statements and notices.  Redistributions must also contain a
   *    copy of this document.
   *
   * 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 name "OpenEJB" must not be used to endorse or promote
   *    products derived from this Software without prior written
   *    permission of The OpenEJB Group.  For written permission,
   *    please contact [EMAIL PROTECTED]
   *
   * 4. Products derived from this Software may not be called "OpenEJB"
   *    nor may "OpenEJB" appear in their names without prior written
   *    permission of The OpenEJB Group. OpenEJB is a registered
   *    trademark of The OpenEJB Group.
   *
   * 5. Due credit should be given to the OpenEJB Project
   *    (http://openejb.org/).
   *
   * THIS SOFTWARE IS PROVIDED BY THE OPENEJB GROUP AND CONTRIBUTORS
   * ``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 OPENEJB GROUP 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.
   *
   * Copyright 2001 (C) The OpenEJB Group. All Rights Reserved.
   *
   * $Id: WebServicesFactory.java,v 1.1 2004/12/22 05:42:39 dblevins Exp $
   */
  package org.openejb.dd.webservices;
  
  import java.io.InputStream;
  import java.net.URL;
  
  import org.apache.geronimo.common.DeploymentException;
  import org.exolab.castor.mapping.Mapping;
  import org.exolab.castor.xml.Unmarshaller;
  import org.exolab.castor.xml.Marshaller;
  import org.xml.sax.InputSource;
  
  public class WebServicesFactory {
  
      private static WebServicesFactory webServicesFactory;
  
      private final Mapping mapping;
      private final Unmarshaller unmarshaller;
  
      private WebServicesFactory() {
          ClassLoader classLoader = WebServicesFactory.class.getClassLoader();
          URL mappingUrl = 
classLoader.getResource("org/openejb/dd/webservices/webservices_1_1.xml");
  
          try {
              mapping = new Mapping(classLoader);
              mapping.loadMapping(mappingUrl);
              unmarshaller = new Unmarshaller(mapping);
          } catch (Exception e) {
              throw (IllegalStateException)new IllegalStateException("Unable to 
initialize xml unmarshaller").initCause(e);
          }
      }
  
      public static WebServicesFactory getInstance() {
          if (webServicesFactory == null){
              webServicesFactory = new WebServicesFactory();
          }
          return webServicesFactory;
      }
  
      public WebServices readXML(URL webservicesURL) throws DeploymentException 
{
          InputStream in = null;
          WebServices webservice = null;
          try {
              in = webservicesURL.openStream();
              webservice = (WebServices) unmarshaller.unmarshal(new 
InputSource(in));
          } catch (Exception e) {
              throw new DeploymentException(e);
          } finally {
              if (in != null) {
                  try {
                      in.close();
                  } catch(Exception ignored) {
                      // Don't care
                  }
              }
          }
          return webservice;
      }
  
  }
  
  
  
  1.1                  
openejb/modules/openejb-builder/src/java/org/openejb/dd/webservices/webservices_1_1.xml
  
  Index: webservices_1_1.xml
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN"
                                                
"http://castor.exolab.org/mapping.dtd";>
  
  <!--
   A dtd version of the J2EE webservices.xml file would look like this:
  
   webservices (webservice-description+)
   webservice-description (webservice-description-name, wsdl-file, 
jaxrpc-mapping-file, port-component+)
   port-component (port-component-name, wsdl-port, service-endpoint-interface, 
service-impl-bean, handler*)
   service-impl-bean (ejb-link|servlet-link)
   handler (handler-name, handler-class, init-param*, soap-header*, soap-role*)
  -->
  <mapping>
      <class name="org.openejb.dd.webservices.WebServices">
          <map-to xml="webservices"/>
          <field name="webServiceDescription" 
type="org.openejb.dd.webservices.WebServiceDescription" collection="array">
              <bind-xml name="webservice-description"/>
          </field>
      </class>
  
      <class name="org.openejb.dd.webservices.WebServiceDescription">
          <map-to xml="webservices-description"/>
          <field name="webServiceDescriptionName" type="java.lang.String">
              <bind-xml name="webservice-description-name" node="element"/>
          </field>
          <field name="wsdlFile" type="java.lang.String">
              <bind-xml name="wsdl-file" node="element"/>
          </field>
          <field name="jaxrpcMappingFile" type="java.lang.String">
              <bind-xml name="jaxrpc-mapping-file" node="element"/>
          </field>
          <field name="portComponent" 
type="org.openejb.dd.webservices.PortComponent" collection="array">
              <bind-xml name="port-component"/>
          </field>
      </class>
  
      <class name="org.openejb.dd.webservices.PortComponent">
          <map-to xml="port-component"/>
          <field name="portComponentName" type="java.lang.String">
              <bind-xml name="port-component-name" node="element"/>
          </field>
          <field name="wsdlPort" type="java.lang.String">
              <bind-xml name="wsdl-port" node="element"/>
          </field>
          <field name="serviceEndpointInterface" type="java.lang.String">
              <bind-xml name="service-endpoint-interface" node="element"/>
          </field>
          <field name="serviceImplBean" 
type="org.openejb.dd.webservices.ServiceImplBean">
              <bind-xml name="service-impl-bean" node="element"/>
          </field>
          <field name="handler" type="org.openejb.dd.webservices.Handler" 
collection="array">
              <bind-xml name="handler"/>
          </field>
      </class>
  
      <class name="org.openejb.dd.webservices.Handler">
          <map-to xml="handler"/>
          <field name="handlerName" type="java.lang.String">
              <bind-xml name="handler-name" node="element"/>
          </field>
          <field name="handlerClass" type="java.lang.String">
              <bind-xml name="handler-class" node="element"/>
          </field>
          <field name="soapHeader" type="java.lang.String" collection="array">
              <bind-xml name="soap-header" node="element"/>
          </field>
          <field name="soapRole" type="java.lang.String" collection="array">
              <bind-xml name="soap-role" node="element"/>
          </field>
      </class>
  
  </mapping>
  
  
  

Reply via email to