ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sag...@apache.org
Subject svn commit: r809831 [4/10] - in /webservices/woden/trunk/java/woden-commons: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/woden/ src/main/java/org/apache/woden/internal/ src/main/java/org/apache...
Date Tue, 01 Sep 2009 05:49:07 GMT
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/Constants.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/Constants.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/Constants.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/Constants.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,162 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+//TODO - consider separating common constants from 2.0 constants
+//TODO - check if any constants copied from w4j can be deleted
+package org.apache.woden.internal.wsdl20;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Constants for WSDL 2.0 elements, attributes and URIs.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class Constants
+{
+    // Namespace Strings.
+    public static final String NS_STRING_WSDL20 =
+        "http://www.w3.org/ns/wsdl";
+    public static final String NS_STRING_XMLNS =
+        "http://www.w3.org/2000/xmlns/";
+    public static final String NS_STRING_XSI =
+        "http://www.w3.org/2001/XMLSchema-instance";
+
+    // Namespace URIs.
+    public static final URI NS_URI_WSDL20 = URI.create(NS_STRING_WSDL20);
+    public static final URI NS_URI_XMLNS = URI.create(NS_STRING_XMLNS);
+    public static final URI NS_URI_XSI = URI.create(NS_STRING_XSI);
+    
+    // Top-level WSDL 2.0 element names.
+    public static final String ELEM_DESCRIPTION = "description";
+    public static final String ELEM_DOCUMENTATION = "documentation";
+    public static final String ELEM_IMPORT = "import";
+    public static final String ELEM_INCLUDE = "include";
+    public static final String ELEM_TYPES = "types";
+    public static final String ELEM_INTERFACE = "interface";
+    public static final String ELEM_BINDING = "binding";
+    public static final String ELEM_SERVICE = "service";
+
+    // Nested WSDL 2.0 element names.
+    public static final String ELEM_FAULT = "fault";
+    public static final String ELEM_OPERATION = "operation";
+    public static final String ELEM_INPUT = "input";
+    public static final String ELEM_OUTPUT = "output";
+    public static final String ELEM_INFAULT = "infault";
+    public static final String ELEM_OUTFAULT = "outfault";
+    public static final String ELEM_ENDPOINT = "endpoint";
+
+    // Top-level WSDL 2.0 qualified element names.
+    public static final QName Q_ELEM_DESCRIPTION =
+        new QName(NS_STRING_WSDL20, ELEM_DESCRIPTION);
+    public static final QName Q_ELEM_DOCUMENTATION =
+        new QName(NS_STRING_WSDL20, ELEM_DOCUMENTATION);
+    public static final QName Q_ELEM_IMPORT =
+        new QName(NS_STRING_WSDL20, ELEM_IMPORT);
+    public static final QName Q_ELEM_INCLUDE =
+        new QName(NS_STRING_WSDL20, ELEM_INCLUDE);
+    public static final QName Q_ELEM_TYPES =
+        new QName(NS_STRING_WSDL20, ELEM_TYPES);
+    public static final QName Q_ELEM_INTERFACE =
+        new QName(NS_STRING_WSDL20, ELEM_INTERFACE);
+    public static final QName Q_ELEM_BINDING =
+        new QName(NS_STRING_WSDL20, ELEM_BINDING);
+    public static final QName Q_ELEM_SERVICE =
+        new QName(NS_STRING_WSDL20, ELEM_SERVICE);
+
+    // Nested WSDL 2.0 qualified element names.
+    public static final QName Q_ELEM_FAULT =
+        new QName(NS_STRING_WSDL20, ELEM_FAULT);
+    public static final QName Q_ELEM_OPERATION =
+        new QName(NS_STRING_WSDL20, ELEM_OPERATION);
+    public static final QName Q_ELEM_INPUT =
+        new QName(NS_STRING_WSDL20, ELEM_INPUT);
+    public static final QName Q_ELEM_OUTPUT =
+        new QName(NS_STRING_WSDL20, ELEM_OUTPUT);
+    public static final QName Q_ELEM_INFAULT =
+        new QName(NS_STRING_WSDL20, ELEM_INFAULT);
+    public static final QName Q_ELEM_OUTFAULT =
+        new QName(NS_STRING_WSDL20, ELEM_OUTFAULT);
+    public static final QName Q_ELEM_ENDPOINT =
+        new QName(NS_STRING_WSDL20, ELEM_ENDPOINT);
+    
+    // Attribute names.
+    public static final String ATTR_ID = "id";
+    public static final String ATTR_NAME = "name";
+    public static final String ATTR_TARGET_NAMESPACE = "targetNamespace";
+    public static final String ATTR_NAMESPACE = "namespace";
+    public static final String ATTR_XMLNS = "xmlns";
+    public static final String ATTR_EXTENDS = "extends";
+    public static final String ATTR_STYLE_DEFAULT = "styleDefault";
+    public static final String ATTR_ELEMENT = "element";
+    public static final String ATTR_PATTERN = "pattern";
+    public static final String ATTR_STYLE = "style";
+    public static final String ATTR_MESSAGE_LABEL = "messageLabel";
+    public static final String ATTR_REF = "ref";
+    public static final String ATTR_REQUIRED = "required";
+    public static final String ATTR_INTERFACE = "interface";
+    public static final String ATTR_TYPE = "type";
+    public static final String ATTR_BINDING = "binding";
+    public static final String ATTR_ADDRESS = "address";
+    public static final String ATTR_LOCATION = "location";
+
+    // Attribute values and NMTokens
+    public static final String VALUE_EMPTY_STRING = "";
+    public static final String VALUE_TRUE = "true";
+    public static final String VALUE_FALSE = "false";
+    public static final String NMTOKEN_VALUE = "#value";
+    public static final String NMTOKEN_ANY = "#any";
+    public static final String NMTOKEN_NONE = "#none";
+    public static final String NMTOKEN_OTHER = "#other";
+    public static final String NMTOKEN_ELEMENT = "#element";
+    
+    //Message Exchange Patterns
+    public static final URI MEP_URI_IN_ONLY = 
+        URI.create("http://www.w3.org/ns/wsdl/in-only");
+    public static final URI MEP_URI_ROBUST_IN_ONLY = 
+        URI.create("http://www.w3.org/ns/wsdl/robust-in-only");
+    public static final URI MEP_URI_IN_OUT = 
+        URI.create("http://www.w3.org/ns/wsdl/in-out");
+    
+    /* Constants representing the values of the properties used to 
+     * configure the Woden runtime (i.e. different to WSDL 2.0 properties).
+     * These typically describe the standards, APIs, etc, supported by this 
+     * implementation of the Woden API.
+     * 
+     * The first part of the constant name indicates its usage:
+     * TYPE_  describes a supported type system, such as the W3C XML Schema.
+     * API_   describes a supported external API, such as DOM
+     */ 
+    public static final String TYPE_XSD_2001 =
+        "http://www.w3.org/2001/XMLSchema";
+    public static final String API_W3C_DOM =
+        "org.w3c.dom";
+    public static final String API_APACHE_WS_XS =
+        "org.apache.ws.commons.schema";   //Apache WS-Commons XmlSchema
+
+  // Qualified attribute names.
+  public static final QName Q_ATTR_REQUIRED =
+    new QName(NS_STRING_WSDL20, ATTR_REQUIRED);   //<wsdl:required>
+
+  // XML Declaration string.
+  public static final String XML_DECL_DEFAULT = "UTF-8";
+  public static final String XML_DECL_START =
+    "<?xml version=\"1.0\" encoding=\"";
+  public static final String XML_DECL_END = "\"?>";
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DescriptionImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DescriptionImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DescriptionImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,644 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.net.URI;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.MessageFormatter;
+import org.apache.woden.internal.WSDLContext;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.TypeDefinition;
+import org.apache.woden.wsdl20.extensions.ExtensionRegistry;
+import org.apache.woden.wsdl20.fragids.DescriptionPart;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.xml.BindingElement;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.ImportElement;
+import org.apache.woden.wsdl20.xml.IncludeElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.NestedElement;
+import org.apache.woden.wsdl20.xml.ServiceElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+
+/**
+ * This class provides the implementation for a Description component from 
+ * the WSDL Component Model, as described in the WSDL 2.0 specification.  
+ * <p>
+ * Note: this class is different to the other WSDL implementation classes, 
+ * which all implement two Java interfaces; a component model interface and the 
+ * interface for the corresponding WSDL element. Different implementations
+ * are used for the Description component and for the &lt;wsdl:description&gt; 
+ * element because the latter exposes the composite structure of imported and 
+ * included WSDL documents, while the Description component 'flattens' this
+ * structure into an abstract view of the WSDL. A separate implementation
+ * class, <code>DescriptionElementImpl</code>, exists to represent
+ * the &lt;wsdl:description&gt; element.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class DescriptionImpl extends WSDLComponentImpl
+                             implements Description, DescriptionElement 
+{
+    private static final String emptyString = "".intern();
+    
+    /*
+     * WSDL Component model data (flattened properties of Description Component)
+     * TODO cache top-level components here with a flush-on-update mechanism
+     */
+    private List fAllElementDeclarations = new Vector();
+    private List fAllTypeDefinitions = new Vector();
+    
+    /*
+     * WSDL Element model data
+     */
+    private URI fDocumentBaseURI = null;
+
+    //<description> attributes
+    private URI fTargetNamespace = null;
+    private Map fNamespaces = new HashMap();
+
+    //<description> child elements
+    private List fImportElements = new Vector();
+    private List fIncludeElements = new Vector();
+    private TypesImpl fTypesElement = null;
+    private List fInterfaceElements = new Vector();
+    private List fBindingElements = new Vector();
+    private List fServiceElements = new Vector();
+    
+    /*
+     * Woden-specific instance variables
+     */
+    
+    private boolean fComponentsInitialized = false;
+    private WSDLContext fWsdlContext;
+    
+    /*
+     * Constructors
+     */
+    private DescriptionImpl() {};
+    
+    public DescriptionImpl(WSDLContext wsdlContext) {
+        fWsdlContext = wsdlContext;
+    }
+    
+    /* ************************************************************
+     *  Description interface methods (the WSDL Component model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getInterfaces()
+     * 
+     * TODO performance to be addressed in this method. Suggest caching with
+     * some sort of notification-on-update to flush the cash and let lazy init
+     * reset it. But best to deal with performance after wsdl create/update has 
+     * been implemented, as we can then baseline the existing dynamic approach
+     * to test for correct behaviour after performance mods have been made. 
+     * (but see to do comment in getNestedDescriptions method too)
+     */
+    public Interface[] getInterfaces() 
+    {
+        List allInterfaces = new Vector();
+        
+        //declared interfaces
+        for(Iterator i=fInterfaceElements.iterator(); i.hasNext(); )
+        {
+            Interface intface = (Interface)i.next();
+            if(!containsComponent(intface, allInterfaces)) {
+                ((InterfaceImpl)intface).setDescriptionComponent(this);
+                allInterfaces.add(intface);
+            }
+        }
+        
+        //nested interfaces
+        List nestedDescs = new Vector(getNestedDescriptions());
+        for(Iterator i=nestedDescs.iterator(); i.hasNext(); )
+        {
+            DescriptionElement desc = (DescriptionElement)i.next();
+            InterfaceElement[] interfaces = desc.getInterfaceElements();
+            for(int j=0; j<interfaces.length; j++)
+            {
+                Interface intface = (Interface)interfaces[j];
+                if(!containsComponent(intface, allInterfaces)) {
+                    ((InterfaceImpl)intface).setDescriptionComponent(this);
+                    allInterfaces.add(intface);
+                }
+            }
+        }
+        
+        Interface[] array = new Interface[allInterfaces.size()];
+        allInterfaces.toArray(array);
+        return array;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getInterface(javax.xml.namespace.QName)
+     */
+    public Interface getInterface(QName name) 
+    {
+        Interface intface = null;
+        
+        if(name != null) 
+        {
+            Interface[] interfaces = getInterfaces();
+            
+            for(int i=0; i<interfaces.length; i++)
+            {
+                if(name.equals(interfaces[i].getName()))
+                {
+                    intface = interfaces[i];
+                    break;
+                }
+            }
+        }
+        
+        return intface;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getBindings()
+     * 
+     * TODO performance to be addressed in this method - see ToDo in getInterface()
+     */
+    public Binding[] getBindings() 
+    {
+        List allBindings = new Vector();
+        
+        //declared bindings
+        for(Iterator i=fBindingElements.iterator(); i.hasNext(); )
+        {
+            Binding binding = (Binding)i.next();
+            if(!containsComponent(binding, allBindings)) {
+                ((BindingImpl)binding).setDescriptionComponent(this);
+                allBindings.add(binding);
+            }
+        }
+        
+        //nested bindings
+        List nestedDescs = new Vector(getNestedDescriptions());
+        for(Iterator i=nestedDescs.iterator(); i.hasNext(); )
+        {
+            DescriptionElement desc = (DescriptionElement)i.next();
+            BindingElement[] bindings = desc.getBindingElements();
+            for(int j=0; j<bindings.length; j++)
+            {
+                Binding binding = (Binding)bindings[j];
+                if(!containsComponent(binding, allBindings)) {
+                    ((BindingImpl)binding).setDescriptionComponent(this);
+                    allBindings.add(binding);
+                }
+            }
+        }
+        
+        Binding[] array = new Binding[allBindings.size()];
+        allBindings.toArray(array);
+        return array;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getBinding(javax.xml.namespace.QName)
+     */
+    public Binding getBinding(QName name) 
+    {
+        Binding binding = null;
+        
+        if(name != null) 
+        {
+            Binding[] bindings = getBindings();
+            
+            for(int i=0; i<bindings.length; i++)
+            {
+                if(name.equals(bindings[i].getName()))
+                {
+                    binding = bindings[i];
+                    break;
+                }
+            }
+        }
+        
+        return binding;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getServices()
+     * 
+     * TODO performance to be addressed in this method - see ToDo in getInterface()
+     */
+    public Service[] getServices() 
+    {
+        List allServices = new Vector();
+        
+        //declared services
+        for(Iterator i=fServiceElements.iterator(); i.hasNext(); )
+        {
+            Service service = (Service)i.next();
+            if(!containsComponent(service, allServices)) {
+                ((ServiceImpl)service).setDescriptionComponent(this);
+                allServices.add(service);
+            }
+        }
+        
+        //nested services
+        List nestedDescs = new Vector(getNestedDescriptions());
+        for(Iterator i=nestedDescs.iterator(); i.hasNext(); )
+        {
+            DescriptionElement desc = (DescriptionElement)i.next();
+            ServiceElement[] services = desc.getServiceElements();
+            for(int j=0; j<services.length; j++)
+            {
+                Service service = (Service)services[j];
+                if(!containsComponent(service, allServices)) {
+                    ((ServiceImpl)service).setDescriptionComponent(this);
+                    allServices.add(service);
+                }
+            }
+        }
+        
+        Service[] array = new Service[allServices.size()];
+        allServices.toArray(array);
+        return array;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getService(javax.xml.namespace.QName)
+     */
+    public Service getService(QName name) 
+    {
+        Service service = null;
+        
+        if(name != null) 
+        {
+            Service[] services = getServices();
+            
+            for(int i=0; i<services.length; i++)
+            {
+                if(name.equals(services[i].getName()))
+                {
+                    service = services[i];
+                    break;
+                }
+            }
+        }
+        
+        return service;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getElementDeclarations()
+     */
+    public ElementDeclaration[] getElementDeclarations() 
+    {
+        if(!fComponentsInitialized) initComponents();
+        ElementDeclaration[] array = new ElementDeclaration[fAllElementDeclarations.size()];
+        fAllElementDeclarations.toArray(array);
+        return array;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getElementDeclaration(javax.xml.namespace.QName)
+     */
+    public ElementDeclaration getElementDeclaration(QName qname)
+    {
+        if(!fComponentsInitialized) initComponents();
+        ElementDeclaration elDec = null;
+        if(qname != null)
+        {
+            Iterator i = fAllElementDeclarations.iterator();
+            while(i.hasNext())
+            {
+                ElementDeclaration ed = (ElementDeclaration)i.next();
+                if(qname.equals(ed.getName())) 
+                {
+                    elDec = ed;
+                    break;
+                }
+            }
+        }
+        return elDec;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getTypeDefinitions()
+     */
+    public TypeDefinition[] getTypeDefinitions() 
+    {
+        if(!fComponentsInitialized) initComponents();
+        TypeDefinition[] array = new TypeDefinition[fAllTypeDefinitions.size()];
+        fAllTypeDefinitions.toArray(array);
+        return array;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#getTypeDefinition(javax.xml.namespace.QName)
+     * TODO consider using Map instead of List
+     */
+    public TypeDefinition getTypeDefinition(QName qname)
+    {
+        if(!fComponentsInitialized) initComponents();
+        TypeDefinition typeDef = null;
+        if(qname != null)
+        {
+            Iterator i = fAllTypeDefinitions.iterator();
+            while(i.hasNext())
+            {
+                TypeDefinition td = (TypeDefinition)i.next();
+                if(qname.equals(td.getName())) 
+                {
+                    typeDef = td;
+                    break;
+                }
+            }
+        }
+        return typeDef;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Description#toElement()
+     */
+    public DescriptionElement toElement()
+    {
+        return this; 
+    }
+    
+    /* ************************************************************
+     *  DescriptionElement interface methods (the XML Element model)
+     * ************************************************************/
+    
+    public void setDocumentBaseURI(URI documentBaseURI) {
+        fDocumentBaseURI = documentBaseURI;
+    }
+    
+    public URI getDocumentBaseURI() {
+        return fDocumentBaseURI;
+    }
+    
+    public void setTargetNamespace(URI namespace) {
+        fTargetNamespace = namespace;    
+    }
+    
+    public URI getTargetNamespace() {
+        return fTargetNamespace;    
+    }
+
+    public ImportElement[] getImportElements()
+    {
+        ImportElement[] array = new ImportElement[fImportElements.size()];
+        fImportElements.toArray(array);
+        return array;
+    }
+    
+    public IncludeElement[] getIncludeElements()
+    {
+        IncludeElement[] array = new IncludeElement[fIncludeElements.size()];
+        fIncludeElements.toArray(array);
+        return array;
+    }
+
+    public TypesElement getTypesElement() 
+    {
+        return fTypesElement;    
+    }
+    
+    public TypesElement addTypesElement() throws WSDLException {
+        if (fTypesElement == null) {
+            fTypesElement = new TypesImpl();
+            fTypesElement.setParentElement(this);
+            return fTypesElement;
+        } else {
+            String msg = fWsdlContext.errorReporter.getFormattedMessage( 
+                    "WSDL523",
+                    null);
+            throw new WSDLException(WSDLException.OTHER_ERROR, msg);
+        }
+    }
+    
+    public InterfaceElement[] getInterfaceElements() 
+    {
+        InterfaceElement[] array = new InterfaceElement[fInterfaceElements.size()];
+        fInterfaceElements.toArray(array);
+        return array;
+    }
+    
+    public BindingElement[] getBindingElements() 
+    {
+        BindingElement[] array = new BindingElement[fBindingElements.size()];
+        fBindingElements.toArray(array);
+        return array;
+    }
+    
+    public ServiceElement[] getServiceElements() 
+    {
+        ServiceElement[] array = new ServiceElement[fServiceElements.size()];
+        fServiceElements.toArray(array);
+        return array;
+    }
+    
+    //creator methods
+    
+    public ImportElement addImportElement() {
+        ImportImpl importEl = new ImportImpl();
+        fImportElements.add(importEl);
+        importEl.setParentElement(this);
+        return importEl;
+    }
+    
+    public IncludeElement addIncludeElement() {
+        IncludeImpl include = new IncludeImpl();
+        fIncludeElements.add(include);
+        include.setParentElement(this);
+        return include;
+    }
+    
+    public InterfaceElement addInterfaceElement() {
+        InterfaceImpl intface = new InterfaceImpl();
+        fInterfaceElements.add(intface);
+        intface.setParentElement(this);
+        return intface; 
+    }
+    
+    public BindingElement addBindingElement() {
+        BindingImpl binding = new BindingImpl();
+        fBindingElements.add(binding);
+        binding.setParentElement(this);
+        return binding;
+    }
+    
+    public ServiceElement addServiceElement() {
+        ServiceImpl service = new ServiceImpl();
+        fServiceElements.add(service);
+        service.setParentElement(this);
+        return service;
+    }
+    
+    /*
+     * @see org.apache.woden.wsdl20.xml.DescriptionElement#toComponent()
+     */
+    public Description toComponent()
+    {
+        //TODO synchronizing the Component data when Element model is modified
+        if(!fComponentsInitialized) {
+            initComponents();
+        }
+        return this;
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+
+    //package private, only needed by impl classes in this package
+    WSDLContext getWsdlContext() {
+        return fWsdlContext;
+    }
+    
+    void addElementDeclaration(ElementDeclaration elDec) 
+    {
+        if(elDec != null) {
+            fAllElementDeclarations.add(elDec);
+        }
+    }
+
+    void addTypeDefinition(TypeDefinition typeDef) 
+    {
+        if(typeDef != null) {
+            fAllTypeDefinitions.add(typeDef);
+        }
+    }
+    
+    private void initComponents() 
+    {
+        //TODO consider moving the builder logic inside this class, maybe as an inner class.
+        fComponentsInitialized = true;
+        new ComponentModelBuilder(this);
+        
+        //Ensure the top-level components (Interface, Binding, Service) refer to this object 
+        //for their containing Description. The implementation of the following 3 methods 
+        //will initialize this reference.
+        getInterfaces();
+        getBindings();
+        getServices();
+    }
+    
+    /* This package private method is called if something in the Element model changes that necessitates
+     * a rebuild of the Component model. For example, if a schema is added to TypesElement the 
+     * ElementDeclaration and TypeDefinition components need to be rebuilt.
+     */
+    void resetComponentsInitialized() {
+        fComponentsInitialized = false;
+    }
+    
+    /*
+     * This method returns the descriptions included by this description (using transitive closure)
+     * and the descriptions for any namespaces imported directly by this description (i.e. not transitive).
+     * It is a helper method for other methods that need to walk the wsdl tree to access the
+     * flattened collection of wsdl components available to this description.
+     * 
+     * TODO imports should be pervasive, components not limited to a single location attribute.
+     * TODO consider performance here (e.g. caching with flush-on-update notification) because this method
+     * will be used by getters for the top-level components (interfaces, bindings, services). 
+     */
+    private List getNestedDescriptions()
+    {
+        List descs = new Vector();
+        
+        //includes are transitive, so navigate the include tree
+        collectIncludedDescriptions(descs, this); 
+        
+        //imports are non-transitive, so just get the directly imported descriptions
+        //and any includes within them.
+        ImportElement[] imports = getImportElements();
+        for(int i = 0; i < imports.length; i++)
+        {
+            DescriptionElement desc = imports[i].getDescriptionElement();
+            if(desc != null) {
+                descs.add(desc);
+                collectIncludedDescriptions(descs, desc);
+            }
+        }
+        
+        return descs;
+    }
+    
+    private void collectIncludedDescriptions(List descs, DescriptionElement desc)
+    {
+        IncludeElement[] includes = desc.getIncludeElements();
+        for(int i = 0; i < includes.length; i++)
+        {
+            DescriptionElement includedDesc = includes[i].getDescriptionElement();
+            if(includedDesc != null && !descs.contains(includedDesc)) 
+            {
+                descs.add(includedDesc);
+            }
+            collectIncludedDescriptions(descs, includedDesc);
+        }
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() { 
+        return  new FragmentIdentifier(new DescriptionPart());
+    }
+    
+    /**
+     * Nested elements within a <code>&lt;description&gt;</code> have attributes of type
+     * <i>xs:NCName</i>. The setter method for the attribute will take an NCName object as
+     * the input parameter. However, to be useful, the getter method returns a QName. The
+     * namespace within the QName has to be the targetNamespace of the <code>&lt;description&gt;</code>
+     * element. This method provides a way to retrieve the targetNamespace and any NS prefix
+     * of the enclosing <code>&lt;description&gt;</code> element.
+     * @param  wElem instance of WSDLElement for which the targetNamespace is required 
+     * @return a String array containing the targetNamespace and prefix of the DescriptionElement
+     *         that is the root element of wElem
+     */
+    static String[] getTargetNamespaceAndPrefix(WSDLElement wElem) {
+        if (wElem instanceof NestedElement) {
+            WSDLElement parent = ((NestedElement) wElem).getParentElement();
+            return getTargetNamespaceAndPrefix(parent);
+        }
+        
+        //We have a description element
+        DescriptionElement desc = ((DescriptionElement) wElem);
+        
+        //Find its target name and prefix.
+        String[] namespace = new String[] {emptyString, emptyString};
+        URI tns = desc.getTargetNamespace();
+        if (tns != null) {
+            namespace[0] = tns.toString();
+            String prefix = desc.getNamespacePrefix(tns);
+            if(prefix != null) {
+                namespace[1] = prefix;
+            }
+        }
+        return namespace;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentableImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentableImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentableImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentableImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.woden.wsdl20.xml.DocumentableElement;
+import org.apache.woden.wsdl20.xml.DocumentationElement;
+
+/**
+ * An abstract superclass for WSDL 2.0 elements which can have &lt;documentation&gt; 
+ * child elements. That is, all WSDL 2.0 elements except the &lt;documentation&gt; 
+ * element itself. Defines accessor methods for manipulating DocumentationElements.
+ * 
+ * @author jkaputin@apache.org
+ */
+public abstract class DocumentableImpl extends WSDLElementImpl
+                                       implements DocumentableElement 
+{
+    private List fDocumentationElements = new Vector();
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.DocumentationElement org.apache.woden.wsdl20.xml.DocumentableElement#addDocumentationElement()
+     */
+    public DocumentationElement addDocumentationElement() 
+    {
+        DocumentationImpl docEl = new DocumentationImpl();
+        fDocumentationElements.add(docEl);
+        docEl.setParentElement(this);
+        return docEl;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.DocumentableElement#getDocumentationElements()
+     */
+    public DocumentationElement[] getDocumentationElements() {
+        DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()];
+        fDocumentationElements.toArray(array);
+        return array;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentationImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentationImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentationImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/DocumentationImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import org.apache.woden.wsdl20.xml.DocumentationElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+import org.apache.woden.XMLElement;
+
+/**
+ * This class implements support for parsing, creating and manipulating a
+ * WSDL 2.0 &lt;wsdl:documentation&gt; XML element.
+ * The &lt;wsdl:documentation&gt; element may contain mixed content, but this 
+ * class does not attempt to understand that content. Instead it just wraps
+ * the &lt;wsdl:documentation&gt; element's content model as a java.lang.Object. 
+ * 
+ * TODO chg inheritance hierachy so this too extends WSDL20ObjectImpl? 
+ * (i.e. move documentation methods from WSDL20ObjectImpl to a DocumentableImpl class)
+ * Currently, this class is a WSDL20Element (interface) but it is not a subclass of
+ * WSDL20ObjectImpl.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class DocumentationImpl extends WSDLElementImpl implements DocumentationElement 
+{
+    private XMLElement fContent;
+    private WSDLElement fParentElem = null;
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.DocumentationElement#setContentModel(java.lang.Object)
+     */
+    public void setContent(XMLElement docEl) {
+        fContent = docEl;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.DocumentationElement#getContentModel()
+     */
+    public XMLElement getContent() {
+        return fContent;
+    }
+
+    /* 
+     * package private, used only by factory methods in this package
+     */
+    void setParentElement(WSDLElement parent) {
+        fParentElem = parent;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement()
+     */
+    public WSDLElement getParentElement() {
+        return fParentElem;
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ElementDeclarationImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ElementDeclarationImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ElementDeclarationImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ElementDeclarationImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,120 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.WSDLReader;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.ElementDeclaration;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.ElementDeclarationPart;
+
+/**
+ * This class represents an ElementDeclaration property of the Description component.
+ * It refers to a global element declaration provided by the underlying type
+ * system (e.g. XML Schema) 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ElementDeclarationImpl implements ElementDeclaration {
+    
+    private QName  fName = null;
+    private URI fSystem = null;
+    private String fContentModel = null;
+    private Object fContent = null;
+
+    /* ************************************************************
+     *  ElementDeclaration interface methods (the WSDL Component model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.ElementDeclaration#getName()
+     */
+    public QName getName() 
+    {
+        return fName;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.ElementDeclaration#getSystem()
+     */
+    public URI getSystem() 
+    {
+        return fSystem;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.ElementDeclaration#getContentModel()
+     */
+    public String getContentModel() 
+    {
+        return fContentModel;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.ElementDeclaration#getContent()
+     */
+    public Object getContent() 
+    {
+        return fContent;
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+
+    public void setName(QName name)
+    {
+        fName = name;
+    }
+
+    public void setSystem(URI typeSystemURI)
+    {
+        fSystem = typeSystemURI;
+    }
+    
+    public void setContentModel(String contentModel)
+    {
+        fContentModel = contentModel;
+    }
+
+    public void setContent(Object elementContent)
+    {
+        fContent = elementContent;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() {        
+        if (fSystem == null | fSystem.toString().equals(WSDLReader.TYPE_XSD_2001)) {
+            return new FragmentIdentifier(new ElementDeclarationPart(fName));
+        } else {
+            return new FragmentIdentifier(new ElementDeclarationPart(fName, fSystem));
+        }
+    }
+
+    public String toString() {
+        return getFragmentIdentifier().toString();
+    }
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/EndpointImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/EndpointImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/EndpointImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/EndpointImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,149 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.Endpoint;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.xml.BindingElement;
+import org.apache.woden.wsdl20.xml.EndpointElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.EndpointPart;
+
+
+/**
+ * This class represents the Endpoint component and the &lt;endpoint&gt; element.
+ * 
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public class EndpointImpl extends NestedImpl 
+                          implements Endpoint,
+                                     EndpointElement 
+{
+    private NCName fName = null;
+    private QName fBindingName = null;
+    private URI fAddress = null;
+
+    /* ************************************************************
+     *  Endpoint interface methods (the WSDL Component model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.Endpoint#getName()
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#getName()
+     */
+    public NCName getName() {
+        return fName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.Endpoint#getBinding()
+     */
+    public Binding getBinding() 
+    {
+        ServiceImpl service = (ServiceImpl)getParent();
+        Description desc = service.getDescriptionComponent();
+        Binding binding = desc.getBinding(fBindingName);
+        return binding;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.Endpoint#getAddress()
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#getAddress()
+     */
+    public URI getAddress() {
+        return fAddress;
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.Endpoint#toElement()
+     */
+    public EndpointElement toElement() {
+        return this;
+    }
+    
+    /* ************************************************************
+     *  EndpointElement interface methods (the XML Element model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#setName(org.apache.woden.types.NCName)
+     */
+    public void setName(NCName name) {
+        fName = name;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#setBindingName(javax.xml.namespace.QName)
+     */
+    public void setBindingName(QName qname) {
+        fBindingName = qname;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#getBindingName()
+     */
+    public QName getBindingName() {
+        return fBindingName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#getBindingElement()
+     */
+    public BindingElement getBindingElement() 
+    {
+        ServiceImpl service = (ServiceImpl)getParentElement();
+        
+        //Cast the containing description element to a description component to re-use its
+        //logic for navigating a composite wsdl to retrieve the in-scope top-level components.
+        Description desc = (Description)service.getParentElement();
+        
+        BindingElement binding = (BindingElement)desc.getBinding(fBindingName);
+        return binding;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.EndpointElement#setAddress(java.net.URI)
+     */
+    public void setAddress(URI uri) {
+        fAddress = uri;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() {
+        Service serviceComp = (Service)getParent();
+        
+        NCName service = new NCName(serviceComp.getName().getLocalPart());
+        
+        return new FragmentIdentifier(new EndpointPart(service ,fName));
+    }
+
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ImportImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ImportImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ImportImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ImportImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.net.URI;
+
+import org.apache.woden.wsdl20.xml.ImportElement;
+
+/**
+ * This class implements the &lt;wsdl:import&gt; element. 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class ImportImpl extends WSDLReferenceImpl implements ImportElement 
+{
+    private URI fNamespace = null;
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.ImportElement#setNamespace(java.net.URI)
+     */
+    public void setNamespace(URI nsURI) 
+    {
+        fNamespace = nsURI;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.ImportElement#getNamespace()
+     */
+    public URI getNamespace() 
+    {
+        return fNamespace;
+    }
+
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/IncludeImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/IncludeImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/IncludeImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/IncludeImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,32 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import org.apache.woden.wsdl20.xml.IncludeElement;
+
+/**
+ * This class implements the &lt;wsdl:include&gt; element. 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class IncludeImpl extends WSDLReferenceImpl implements IncludeElement 
+{
+    /* No additional definitions required. This class inherits all of its behaviour 
+     * from WSDLReferenceImpl. We just need this subclass so we can create an
+     * object representing IncludeElement, which maps to <wsdl:include>.
+     */
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,170 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.types.QNameTokenUnion;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.InterfaceFaultPart;
+
+/**
+ * This class represents the InterfaceFault component from the WSDL 2.0 Component 
+ * Model and the &lt;fault&gt; child element of the &lt;interface&gt; element. 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class InterfaceFaultImpl extends NestedImpl
+                                implements InterfaceFault,
+                                           InterfaceFaultElement 
+{
+    //WSDL Component model data
+    private NCName fName = null;
+
+    //XML Element model data
+    private QNameTokenUnion fElement = null;
+    
+    /* ************************************************************
+     *  InterfaceFault methods (i.e. WSDL Component model)
+     * ************************************************************/
+    
+    /*
+     * @see org.apache.woden.wsdl20.InterfaceFault#getName()
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getName()
+     */
+    public QName getName() 
+    {
+        QName name = null;
+        if (fName != null) {
+            String[] tns = DescriptionImpl.getTargetNamespaceAndPrefix(this);
+            name = new QName(tns[0], fName.toString(), tns[1]);
+        }
+        return name;
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.InterfaceFault#getMessageContentModel()
+     */
+    public String getMessageContentModel() {
+        String model = Constants.NMTOKEN_OTHER;;
+        
+        if (fElement != null) {
+            if (fElement.isQName()) {
+                model = Constants.NMTOKEN_ELEMENT;
+            } else if(fElement.isToken()) {
+                model = fElement.getToken();
+            }
+        }
+        return model;
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.InterfaceFault#getElementDeclaration()
+     */
+    public ElementDeclaration getElementDeclaration() 
+    {
+        ElementDeclaration elemDecl = null;
+        
+        if(fElement != null && fElement.isQName()) {
+            Interface interfac = (Interface)getParent();
+            Description desc = ((InterfaceImpl)interfac).getDescriptionComponent();
+            elemDecl = desc.getElementDeclaration(fElement.getQName());
+        }
+        return elemDecl;
+    }
+    
+    /*
+     * @see org.apache.woden.wsdl20.InterfaceFault#toElement()
+     */
+    public InterfaceFaultElement toElement() {
+        return this;
+    }
+    
+    /* ************************************************************
+     *  InterfaceFaultElement methods (i.e. XML Element model)
+     * ************************************************************/
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setName(NCName)
+     */
+    public void setName(NCName name)
+    {
+        fName = name;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#setElementName(QName)
+     */
+    public void setElement(QNameTokenUnion qnameTokenUnion)
+    {
+        fElement = qnameTokenUnion;
+    }
+    
+    /*
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getElementName()
+     */
+    public QNameTokenUnion getElement() 
+    {
+        return fElement;
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultElement#getElement()
+     */
+    public XmlSchemaElement getXmlSchemaElement() 
+    {
+        XmlSchemaElement xse = null;
+        if (fElement != null && fElement.isQName()) {
+            InterfaceElement interfac = (InterfaceElement)getParentElement();
+            DescriptionElement desc = (DescriptionElement)interfac.getParentElement();
+            TypesElement types = desc.getTypesElement();
+            if(types != null) {
+                xse = ((TypesImpl)types).getElementDeclaration(fElement.getQName());
+            }
+        }
+        return xse;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() {
+        Interface interfaceComp = (Interface)getParent();
+        
+        NCName interfaceName = new NCName(interfaceComp.getName().getLocalPart());
+        
+        return new FragmentIdentifier(new InterfaceFaultPart(interfaceName, fName));
+    }
+
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceFaultReferenceImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,156 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.InterfaceFaultReferencePart;
+
+/**
+ * This class represents the InterfaceFaultReference component of the 
+ * WSDL 2.0 Component model and the &lt;infault&gt; and &lt;outfault&gt; 
+ * child elements of an interface &lt;operation&gt;. 
+ * 
+ * @author jkaputin@apache.org
+ */
+public class InterfaceFaultReferenceImpl extends NestedImpl
+                                         implements InterfaceFaultReference,
+                                                    InterfaceFaultReferenceElement 
+{
+    private NCName fMessageLabel = null;
+    private Direction fDirection = null;
+    private QName fRef = null;
+
+    /* ************************************************************
+     *  InterfaceFaultReference methods (i.e. WSDL Component model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.InterfaceFaultReference#getInterfaceFault()
+     */
+    public InterfaceFault getInterfaceFault() 
+    {
+        InterfaceOperation oper = (InterfaceOperation)getParent();
+        Interface interfac = (Interface)oper.getParent();
+        InterfaceFault intFault = interfac.getFromAllInterfaceFaults(fRef);
+        return intFault;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.InterfaceFaultReference#getMessageLabel()
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getMessageLabel()
+     */
+    public NCName getMessageLabel() {
+        return fMessageLabel;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.InterfaceFaultReference#getDirection()
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getDirection()
+     */
+    public Direction getDirection() {
+        return fDirection;
+    }
+
+    /*
+     * @see org.apache.woden.wsdl20.InterfaceFaultReference#toElement()
+     */
+    public InterfaceFaultReferenceElement toElement() {
+        return this;
+    }
+    
+    /* ************************************************************
+     *  InterfaceFaultReferenceElement methods (i.e. XML Element model)
+     * ************************************************************/
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#setRef(javax.xml.namespace.QName)
+     */
+    public void setRef(QName faultQName) {
+        fRef = faultQName;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getRef()
+     */
+    public QName getRef() {
+        return fRef;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement#getInterfaceFaultElement()
+     */
+    public InterfaceFaultElement getInterfaceFaultElement() 
+    {
+        InterfaceFaultElement fault = null;
+        InterfaceOperationElement oper = (InterfaceOperationElement)getParentElement();
+        InterfaceElement interfac = (InterfaceElement)oper.getParentElement();
+        if (interfac != null) {
+            InterfaceFault faultComp = ((Interface)interfac).getFromAllInterfaceFaults(fRef);
+            if (faultComp != null) {
+                fault = faultComp.toElement();
+            }
+        }
+        return fault;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.FaultReferenceElement#setMessageLabel(org.apache.woden.wsdl20.enumeration.MessageLabel)
+     */
+    public void setMessageLabel(NCName msgLabel) {
+        fMessageLabel = msgLabel;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.FaultReferenceElement#setDirection(org.apache.woden.wsdl20.enumeration.Direction)
+     */
+    public void setDirection(Direction dir) {
+        fDirection = dir;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() {
+        //Find parent components.
+        InterfaceOperation interfaceOperationComp = (InterfaceOperation)getParent();
+        Interface interfaceComp = (Interface)interfaceOperationComp.getParent();
+        //Get needed properties.
+        NCName interfaceName = new NCName(interfaceComp.getName().getLocalPart());
+        NCName interfaceOperation = new NCName(interfaceOperationComp.getName().getLocalPart());
+        //Return a new FragmentIdentifier.
+        return new FragmentIdentifier(new InterfaceFaultReferencePart(interfaceName, interfaceOperation, fMessageLabel, fRef));
+    }
+
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+    
+}

Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceImpl.java Tue Sep  1 05:49:02 2009
@@ -0,0 +1,554 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.woden.internal.wsdl20;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.InterfacePart;
+
+/**
+ * This class represents the Interface component from the 
+ * WSDL 2.0 Component Model and &lt;interface&gt; element.
+ * 
+ * @author jkaputin@apache.org
+ */
+public class InterfaceImpl extends WSDLComponentImpl
+                           implements Interface, InterfaceElement 
+{
+    private WSDLElement fParentElem = null;
+    
+    /* This field refers to the Description component which contains this Interface
+     * component in its {interfaces} property. It is set whenever this Interface is 
+     * returned by that Description's getInterfaces() or getInterface(QName) methods. 
+     * Note that with modularization via a wsdl import or include, this 
+     * reference may be different to fDescriptionElement because it refers to the 
+     * importing or including description at the top of the wsdl tree (whereas the 
+     * latter refers to the description in which this interface is directly declared).
+     * This field is used to retrieve components that are available (i.e. in-scope) 
+     * to the top-level Description component. e.g. it is used with interface extension 
+     * to retrieve Interface components in this Interface's {extended interfaces} 
+     * property from the set of Interfaces available (i.e. in-scope) to the Description.
+     */ 
+    private Description fDescriptionComponent = null;
+    
+    private NCName fName = null;
+    private List fExtends = new Vector();
+    private List fStyleDefault = new Vector();
+    private List fInterfaceFaultElements = new Vector();
+    private List fInterfaceOperationElements = new Vector();
+
+    /* ************************************************************
+     *  Interface interface methods (the WSDL Component model)
+     * ************************************************************/
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getName()
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getName()
+     */
+    public QName getName() 
+    {
+        QName name = null;
+        if (fName != null) {
+            String[] tns = DescriptionImpl.getTargetNamespaceAndPrefix(this);
+            name = new QName(tns[0], fName.toString(), tns[1]);
+        }
+        return name;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getExtendedInterface(javax.xml.namespace.QName)
+     */
+    public Interface getExtendedInterface(QName qname) 
+    {
+        Interface intface = fDescriptionComponent.getInterface(qname); 
+        return intface;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getExtendedInterfaces()
+     */
+    public Interface[] getExtendedInterfaces() 
+    {
+        List interfaces = new Vector();
+        for(Iterator it = fExtends.iterator(); it.hasNext();)
+        {
+            QName qn = (QName)it.next();
+            Interface intface = getExtendedInterface(qn);
+            if(intface != null) interfaces.add(intface);
+        }
+        
+        Interface[] array = new Interface[interfaces.size()];
+        interfaces.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getInterfaceFaults()
+     */
+    public InterfaceFault[] getInterfaceFaults() 
+    {
+        InterfaceFault[] array = new InterfaceFault[fInterfaceFaultElements.size()];
+        fInterfaceFaultElements.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getInterfaceFault(javax.xml.namespace.QName)
+     */
+    public InterfaceFault getInterfaceFault(QName faultName) 
+    {
+        return (InterfaceFault)getInterfaceFaultElement(faultName);
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getAllInterfaceFaults()
+     */
+    public InterfaceFault[] getAllInterfaceFaults() 
+    {
+        List allInterfaces = new Vector();
+        List allInterfaceFaults = new Vector();
+        getAllInterfaceFaults(this, allInterfaces, allInterfaceFaults);
+        
+        InterfaceFault[] array = new InterfaceFault[allInterfaceFaults.size()];
+        allInterfaceFaults.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getFromAllInterfaceFaults(javax.xml.namespace.QName)
+     */
+    public InterfaceFault getFromAllInterfaceFaults(QName faultName) 
+    {
+        InterfaceFault theFault = null;
+        if(faultName != null) {
+            InterfaceFault[] faults = getAllInterfaceFaults();
+            for(int i=0; i<faults.length; i++) {
+                InterfaceFault fault = faults[i];
+                if(faultName.equals(fault.getName())) {
+                    theFault = fault;
+                    break;
+                }
+            }
+        }
+        return theFault;
+    }
+
+    /* 
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getInterfaceOperations()
+     */
+    public InterfaceOperation[] getInterfaceOperations() 
+    {
+        InterfaceOperation[] array = new InterfaceOperation[fInterfaceOperationElements.size()];
+        fInterfaceOperationElements.toArray(array);
+        return array;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getInterfaceOperation(javax.xml.namespace.QName)
+     */
+    public InterfaceOperation getInterfaceOperation(QName operName) 
+    {
+        return (InterfaceOperation)getInterfaceOperationElement(operName);
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getAllInterfaceOperations()
+     */
+    public InterfaceOperation[] getAllInterfaceOperations() 
+    {
+        List allInterfaces = new Vector();
+        List allInterfaceOperations = new Vector();
+        getAllInterfaceOperations(this, allInterfaces, allInterfaceOperations);
+        
+        InterfaceOperation[] array = new InterfaceOperation[allInterfaceOperations.size()];
+        allInterfaceOperations.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#getFromAllInterfaceOperations(javax.xml.namespace.QName)
+     */
+    public InterfaceOperation getFromAllInterfaceOperations(QName operName) 
+    {
+        InterfaceOperation theOper = null;
+        if(operName != null) {
+            InterfaceOperation[] opers = getAllInterfaceOperations();
+            for(int i=0; i<opers.length; i++) {
+                InterfaceOperation oper = opers[i];
+                if(operName.equals(oper.getName())) {
+                    theOper = oper;
+                    break;
+                }
+            }
+        }
+        return theOper;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.Interface#toElement()
+     */
+    public InterfaceElement toElement() {
+        return this;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#equals(WSDLComponent)
+     */
+    public boolean equals(WSDLComponent comp)
+    {
+        //compare object refs
+        if(this == comp) return true;
+        
+        if(!(comp instanceof Interface)) {
+            return false;
+        }
+        
+        Interface other = (Interface)comp;
+        
+        //compare {name}
+        QName myName = getName();
+        if(myName != null && !myName.equals(other.getName())) return false;
+        
+        /* To compare {extended interfaces} we cannot just retrieve and compare the two sets 
+         * of extended Interface components because we'd enter a recursive loop. To get the
+         * extended interfaces (i.e. to resolve the qnames in the 'extends' attribute)
+         * we need to get the set of interfaces available to the Description, which in turn 
+         * invokes this equivalence checking method.
+         * Instead, compare just the qnames in the 'extends' attributes, but we first 
+         * eliminate any duplicate qnames to ensure we make a logical test for 
+         * equivalence (i.e. use Set comparison).
+         */
+        Set thisExtendsSet = new HashSet(fExtends);
+        QName[] otherExtends = ((InterfaceElement)other).getExtendedInterfaceNames();
+        Set otherExtendsSet = new HashSet(); 
+        for(int i=0; i<otherExtends.length; i++)
+        {
+            otherExtendsSet.add(otherExtends[i]);
+        }
+        if(thisExtendsSet.size() != otherExtendsSet.size()) return false;
+        if(!(thisExtendsSet.containsAll(otherExtendsSet) && otherExtendsSet.containsAll(thisExtendsSet)))
+        {
+            return false;
+        }
+        
+        //TODO compare {interface faults}
+        //TODO compare {interface operations}
+            
+        return true;    
+    }
+    
+    /* ************************************************************
+     *  InterfaceElement interface methods (the XML Element model)
+     * ************************************************************/
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#setName(NCName)
+     */
+    public void setName(NCName name) {
+        fName = name;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#addStyleDefaultURI(URI)
+     */
+    public void addStyleDefaultURI(URI uri)
+    {
+        if(uri != null) {
+            fStyleDefault.add(uri);
+        }
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getStyleDefault()
+     */
+    public URI[] getStyleDefault()
+    {
+        URI[] array = new URI[fStyleDefault.size()];
+        fStyleDefault.toArray(array);
+        return array;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#addExtendedInterfaceName(javax.xml.namespace.QName)
+     */
+    public void addExtendedInterfaceName(QName interfaceName)
+    {
+        if(interfaceName != null) {
+            fExtends.add(interfaceName);
+        }
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#removeExtendedInterfaceName(javax.xml.namespace.QName)
+     */
+    public void removeExtendedInterfaceName(QName interfaceName)
+    {
+        if(interfaceName != null) {
+            fExtends.remove(interfaceName);
+        }
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getExtendedInterfaceNames()
+     */
+    public QName[] getExtendedInterfaceNames()
+    {
+        QName[] array = new QName[fExtends.size()];
+        fExtends.toArray(array);
+        return array;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getExtendedInterfaceElement(javax.xml.namespace.QName)
+     */
+    public InterfaceElement getExtendedInterfaceElement(QName interfaceName)
+    {
+        //Cast the containing description element to a description component to re-use its
+        //logic for navigating a composite wsdl to retrieve the in-scope top-level components.
+        Description desc = (Description)fParentElem;
+        InterfaceElement intface = (InterfaceElement)desc.getInterface(interfaceName); 
+        return intface;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getExtendedInterfaceElements()
+     */
+    public InterfaceElement[] getExtendedInterfaceElements()
+    {
+        List interfaces = new Vector();
+        for(Iterator it = fExtends.iterator(); it.hasNext();)
+        {
+            QName qn = (QName)it.next();
+            InterfaceElement intface = getExtendedInterfaceElement(qn);
+            if(intface != null) interfaces.add(intface);
+        }
+        
+        InterfaceElement[] array = new InterfaceElement[interfaces.size()];
+        interfaces.toArray(array);
+        return array;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#addInterfaceFaultElement()
+     */
+    public InterfaceFaultElement addInterfaceFaultElement()
+    {
+        InterfaceFaultImpl fault = new InterfaceFaultImpl();
+        fInterfaceFaultElements.add(fault);
+        fault.setParentElement(this);
+        return fault;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceFaultElement(javax.xml.namespace.QName)
+     */
+    public InterfaceFaultElement getInterfaceFaultElement(QName faultName)
+    {
+        InterfaceFaultElement fault = null;
+        
+        if(faultName != null)
+        {
+            InterfaceFaultElement tempFault = null;
+            for(Iterator i=fInterfaceFaultElements.iterator(); i.hasNext(); )
+            {
+                tempFault = (InterfaceFaultElement)i.next();
+                if(faultName.equals(tempFault.getName()))
+                {
+                    fault = tempFault;
+                    break;
+                }
+            }
+        }
+        
+        return fault;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceFaultElements()
+     */
+    public InterfaceFaultElement[] getInterfaceFaultElements()
+    {
+        InterfaceFaultElement[] array = new InterfaceFaultElement[fInterfaceFaultElements.size()];
+        fInterfaceFaultElements.toArray(array);
+        return array;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#addInterfaceOperationElement()
+     */
+    public InterfaceOperationElement addInterfaceOperationElement()
+    {
+        InterfaceOperationImpl operation = new InterfaceOperationImpl();
+        fInterfaceOperationElements.add(operation);
+        operation.setParentElement(this);
+        return operation;
+    }
+    
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceOperationElement(javax.xml.namespace.QName)
+     */
+    public InterfaceOperationElement getInterfaceOperationElement(QName operName)
+    {
+        InterfaceOperationElement oper = null;
+        
+        if(operName != null)
+        {
+            InterfaceOperationElement tempOper = null;
+            for(Iterator i=fInterfaceOperationElements.iterator(); i.hasNext(); )
+            {
+                tempOper = (InterfaceOperationElement)i.next();
+                if(operName.equals(tempOper.getName()))
+                {
+                    oper = tempOper;
+                    break;
+                }
+            }
+        }
+        
+        return oper;
+    }
+
+    /* 
+     * @see org.apache.woden.wsdl20.xml.InterfaceElement#getInterfaceOperationElements()
+     */
+    public InterfaceOperationElement[] getInterfaceOperationElements()
+    {
+        InterfaceOperationElement[] array = new InterfaceOperationElement[fInterfaceOperationElements.size()];
+        fInterfaceOperationElements.toArray(array);
+        return array;
+    }
+
+    /* 
+     * package private, used only by factory methods in this package
+     */
+    void setParentElement(WSDLElement parent) {
+        fParentElem = parent;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.woden.wsdl20.xml.NestedElement#getParentElement()
+     */
+    public WSDLElement getParentElement() {
+        return fParentElem;
+    }
+    
+    /* ************************************************************
+     *  Non-API implementation methods
+     * ************************************************************/
+
+    /*
+     * Retrieve all the interface operations declared by a specified interface or derived
+     * from interfaces that it extends, directly or indirectly, and accumulate them in
+     * the specified List. Eliminate duplicate operations.
+     */
+    private void getAllInterfaceOperations(Interface interfac, List allInterfaces, List allOpers) {
+        //check for circular Interface references to avoid infinite loop
+        if(containsComponent(interfac, allInterfaces)) {
+            return;
+        } else {
+            allInterfaces.add(interfac);
+        }
+        
+        //get the declared operations for the specified Interface
+        InterfaceOperation[] declaredOpers = interfac.getInterfaceOperations();
+        for(int i=0; i<declaredOpers.length; i++) {
+            InterfaceOperation oper = declaredOpers[i];
+            if(!containsComponent(oper, allOpers)) {
+                allOpers.add(oper);
+            }
+        }
+        
+        //get the derived operations from each extended interface
+        Interface[] extInts = interfac.getExtendedInterfaces();
+        for(int j=0; j<extInts.length; j++) {
+            getAllInterfaceOperations(extInts[j], allInterfaces, allOpers);
+        }
+    }
+    
+    /*
+     * Retrieve all the interface faults declared by a specified interface or derived
+     * from interfaces that it extends, directly or indirectly, and accumulate them in
+     * the specified List. Eliminate duplicate faults.
+     */
+    private void getAllInterfaceFaults(Interface interfac, List allInterfaces, List allFaults) {
+        //check for circular Interface references to avoid infinite loop
+        if(containsComponent(interfac, allInterfaces)) {
+            return;
+        } else {
+            allInterfaces.add(interfac);
+        }
+        
+        //get the declared faults for the specified Interface
+        InterfaceFault[] declaredFaults = interfac.getInterfaceFaults();
+        for(int i=0; i<declaredFaults.length; i++) {
+            InterfaceFault fault = declaredFaults[i];
+            if(!containsComponent(fault, allFaults)) {
+                allFaults.add(fault);
+            }
+        }
+        
+        //get the derived faults from each extended interface
+        Interface[] extInts = interfac.getExtendedInterfaces();
+        for(int j=0; j<extInts.length; j++) {
+            getAllInterfaceFaults(extInts[j], allInterfaces, allFaults);
+        }
+    }
+    
+    /*
+     * These package private accessors refer to the Description component
+     * in which this Interface is contained (i.e. contained in its {interfaces}
+     * property). They are declared package private so that they can be used by the
+     * Woden implementation without exposing them to the API (i.e. by DescriptionImpl)
+     */
+    void setDescriptionComponent(Description desc)
+    {
+        fDescriptionComponent = desc;
+    }
+    
+    Description getDescriptionComponent() {
+        return fDescriptionComponent;
+    }
+    
+    /*
+     * (non-Javadoc)
+     * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+     */
+    public FragmentIdentifier getFragmentIdentifier() {
+        return new FragmentIdentifier(new InterfacePart(fName));
+    }
+    
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org


Mime
View raw message