You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by sa...@apache.org on 2009/09/01 07:49:07 UTC
svn commit: r809831 [5/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...
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,178 @@
+/**
+ * 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.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.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.InterfaceMessageReferencePart;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+
+/**
+ * This class represents the <input> and <output>
+ * child elements of interface operation.
+ *
+ * @author jkaputin@apache.org
+ */
+public class InterfaceMessageReferenceImpl extends NestedImpl
+ implements InterfaceMessageReference,
+ InterfaceMessageReferenceElement
+{
+ //WSDL Component model data
+ private NCName fMessageLabel = null;
+ private Direction fDirection = null;
+ private QNameTokenUnion fElement = null;
+
+ /* ************************************************************
+ * InterfaceMessageReference methods (the WSDL Component model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceMessageReference#getMessageLabel()
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getMessageLabel()
+ */
+ public NCName getMessageLabel() {
+ return fMessageLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceMessageReference#getDirection()
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getDirection()
+ */
+ public Direction getDirection() {
+ return fDirection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceMessageReference#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;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceMessageReference#getElementDeclaration()
+ */
+ public ElementDeclaration getElementDeclaration()
+ {
+ ElementDeclaration elemDecl = null;
+
+ if(fElement != null && fElement.isQName()) {
+ InterfaceOperation oper = (InterfaceOperation)getParent();
+ Interface interfac = (Interface)oper.getParent();
+ Description desc = ((InterfaceImpl)interfac).getDescriptionComponent();
+ elemDecl = desc.getElementDeclaration(fElement.getQName());
+ }
+ return elemDecl;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.InterfaceMessageReference#toElement()
+ */
+ public InterfaceMessageReferenceElement toElement() {
+ return this;
+ }
+
+ /* ************************************************************
+ * InterfaceMessageReferenceElement methods (the XML Element model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setMessageLabel(org.apache.woden.wsdl20.enumeration.MessageLabel)
+ */
+ public void setMessageLabel(NCName msgLabel) {
+ fMessageLabel = msgLabel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setElementName(javax.xml.namespace.QName)
+ */
+ public void setElement(QNameTokenUnion element) {
+ fElement = element;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getElementName()
+ */
+ public QNameTokenUnion getElement() {
+ return fElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getElement()
+ */
+ public XmlSchemaElement getXmlSchemaElement()
+ {
+ XmlSchemaElement xse = null;
+ if(fElement != null && fElement.isQName()) {
+ InterfaceOperationElement oper = (InterfaceOperationElement)getParentElement();
+ InterfaceElement interfac = (InterfaceElement)oper.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.xml.InterfaceMessageReferenceElement#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() {
+ InterfaceOperation interfaceOperationComp = (InterfaceOperation)getParent();
+ Interface interfaceComp = (Interface)interfaceOperationComp.getParent();
+
+ NCName interfaceName = new NCName(interfaceComp.getName().getLocalPart());
+ NCName interfaceOperation = new NCName(interfaceOperationComp.getName().getLocalPart());
+
+ return new FragmentIdentifier(new InterfaceMessageReferencePart(interfaceName, interfaceOperation, fMessageLabel));
+ }
+
+ /* ************************************************************
+ * Non-API implementation methods
+ * ************************************************************/
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/InterfaceOperationImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,244 @@
+/**
+ * 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.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.types.NCName;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.InterfaceFaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.InterfaceOperationPart;
+
+/**
+ * This class represents the InterfaceOperation component from the WSDL 2.0 Component
+ * Model and the <operation> child element of the <interface> element.
+ *
+ * @author jkaputin@apache.org
+ */
+public class InterfaceOperationImpl extends NestedImpl
+ implements InterfaceOperation,
+ InterfaceOperationElement
+{
+ //Component data
+ private NCName fName = null;
+ private URI fMessageExchangePattern = null;
+ private List fStyle = new Vector();
+
+ //XML data
+ private List fMessageRefs = new Vector();
+ private List fFaultRefs = new Vector();
+
+ /* ************************************************************
+ * InterfaceOperation methods (the WSDL Component model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceOperation#getName()
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#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;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceOperation#getMessageExchangePattern()
+ */
+ public URI getMessageExchangePattern()
+ {
+ return (fMessageExchangePattern != null) ?
+ fMessageExchangePattern : Constants.MEP_URI_IN_OUT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceOperation#getInterfaceMessageReferences()
+ */
+ public InterfaceMessageReference[] getInterfaceMessageReferences()
+ {
+ InterfaceMessageReference[] array = new InterfaceMessageReference[fMessageRefs.size()];
+ fMessageRefs.toArray(array);
+ return array;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceOperation#getInterfaceFaultReferences()
+ */
+ public InterfaceFaultReference[] getInterfaceFaultReferences()
+ {
+ InterfaceFaultReference[] array = new InterfaceFaultReference[fFaultRefs.size()];
+ fFaultRefs.toArray(array);
+ return array;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.InterfaceOperation#getStyle()
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getStyle()
+ */
+ public URI[] getStyle()
+ {
+ URI[] array = new URI[0];
+ if(fStyle.size() > 0)
+ {
+ array = new URI[fStyle.size()];
+ fStyle.toArray(array);
+ } else {
+ InterfaceElement intf = (InterfaceElement)getParentElement();
+ URI[] styleDef = intf.getStyleDefault();
+ if(styleDef.length > 0) {
+ array = styleDef;
+ }
+ }
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.InterfaceOperation#toElement()
+ */
+ public InterfaceOperationElement toElement() {
+ return this;
+ }
+
+ /* ************************************************************
+ * InterfaceOperationElement methods (the XML model)
+ * ************************************************************/
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#setName(NCName)
+ */
+ public void setName(NCName name)
+ {
+ fName = name;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#setPattern(URI)
+ */
+ public void setPattern(URI uri)
+ {
+ fMessageExchangePattern = uri;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getPattern()
+ */
+ public URI getPattern()
+ {
+ return fMessageExchangePattern;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addStyleURI(URI)
+ */
+ public void addStyleURI(URI uri)
+ {
+ if(uri != null) {
+ fStyle.add(uri);
+ }
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeStyleURI(URI)
+ */
+ public void removeStyleURI(URI uri)
+ {
+ fStyle.remove(uri);
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addInterfaceMessageReferenceElement()
+ */
+ public InterfaceMessageReferenceElement addInterfaceMessageReferenceElement()
+ {
+ InterfaceMessageReferenceImpl msgRef = new InterfaceMessageReferenceImpl();
+ fMessageRefs.add(msgRef);
+ msgRef.setParentElement(this);
+ return msgRef;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeInterfaceMessageReferenceElement(InterfaceMessageReferenceElement)
+ */
+ public void removeInterfaceMessageReferenceElement(InterfaceMessageReferenceElement msgRef)
+ {
+ fMessageRefs.remove(msgRef);
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getInterfaceMessageReferenceElements()
+ */
+ public InterfaceMessageReferenceElement[] getInterfaceMessageReferenceElements()
+ {
+ InterfaceMessageReferenceElement[] array = new InterfaceMessageReferenceElement[fMessageRefs.size()];
+ fMessageRefs.toArray(array);
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#addInterfaceFaultReferenceElement()
+ */
+ public InterfaceFaultReferenceElement addInterfaceFaultReferenceElement()
+ {
+ InterfaceFaultReferenceImpl faultRef = new InterfaceFaultReferenceImpl();
+ fFaultRefs.add(faultRef);
+ faultRef.setParentElement(this);
+ return faultRef;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#removeInterfaceFaultReferenceElement(InterfaceFaultReferenceElement)
+ */
+ public void removeInterfaceFaultReferenceElement(InterfaceFaultReferenceElement faultRef)
+ {
+ fFaultRefs.remove(faultRef);
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.InterfaceOperationElement#getInterfaceFaultReferenceElements()
+ */
+ public InterfaceFaultReferenceElement[] getInterfaceFaultReferenceElements()
+ {
+ InterfaceFaultReferenceElement[] array = new InterfaceFaultReferenceElement[fFaultRefs.size()];
+ fFaultRefs.toArray(array);
+ return array;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#getFragmentIdentifier()
+ */
+ public FragmentIdentifier getFragmentIdentifier() {
+ NCName interfaceName = new NCName(((Interface)this.getParent()).getName().getLocalPart());
+ return new FragmentIdentifier(new InterfaceOperationPart(interfaceName, fName));
+ }
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/NestedImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/NestedImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/NestedImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/NestedImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,58 @@
+/**
+ * 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.NestedComponent;
+import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.xml.NestedElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+
+/**
+ * This abstract superclass implements support for accessing or
+ * setting the 'parent' of a nested WSDL component.
+ * All such classes will directly or indirectly extend this abstract
+ * class.
+ *
+ * @author jkaputin@apache.org
+ */
+public abstract class NestedImpl extends WSDLComponentImpl
+ implements NestedComponent,
+ NestedElement
+{
+ private WSDLElement fParentElem = null;
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.NestedComponent#getParent()
+ */
+ public WSDLComponent getParent() {
+ return (WSDLComponent)fParentElem;
+ }
+
+ /*
+ * 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/ServiceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ServiceImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ServiceImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/ServiceImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,230 @@
+/**
+ * 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.Iterator;
+import java.util.List;
+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.Endpoint;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.TypeDefinitionPart;
+import org.apache.woden.wsdl20.xml.EndpointElement;
+import org.apache.woden.wsdl20.xml.InterfaceElement;
+import org.apache.woden.wsdl20.xml.ServiceElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.ServicePart;
+
+/**
+ * This class represents the Service component and the
+ * <service> element.
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ */
+public class ServiceImpl extends WSDLComponentImpl
+ implements Service, ServiceElement
+{
+ private WSDLElement fParentElem = null;
+
+ /* This field refers to the Description component which contains this Service
+ * component in its {services} property. It is set whenever this Service is
+ * returned by that Description's getServices() or getService(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 service is directly declared).
+ * This field is used to retrieve components that are available (i.e. in-scope)
+ * to the top-level Description component.
+ */
+ private Description fDescriptionComponent = null;
+
+ private NCName fName = null;
+ private QName fInterfaceName = null;
+ private List fEndpoints = new Vector();
+
+ /* ************************************************************
+ * Service interface methods (the WSDL Component model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.Service#getName()
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#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;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.Service#getInterface()
+ */
+ public Interface getInterface()
+ {
+ Description desc = fDescriptionComponent;
+ Interface interfac = desc.getInterface(fInterfaceName);
+ return interfac;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.Service#getEndpoint(org.apache.woden.types.NCName)
+ *
+ * TODO add a testcase for this method
+ */
+ public Endpoint getEndpoint(NCName name)
+ {
+ Endpoint endpoint = null;
+ if(name != null)
+ {
+ String nameString = name.toString();
+ for(Iterator i=fEndpoints.iterator(); i.hasNext(); )
+ {
+ Endpoint tmpEP = (Endpoint)i.next();
+ String tmpStr = tmpEP.getName() != null ? tmpEP.getName().toString() : null;
+ if(nameString.equals(tmpStr))
+ {
+ endpoint = tmpEP;
+ break;
+ }
+ }
+ }
+ return endpoint;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.Service#getEndpoints()
+ */
+ public Endpoint[] getEndpoints() {
+ Endpoint[] array = new Endpoint[fEndpoints.size()];
+ fEndpoints.toArray(array);
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.Service#toElement()
+ */
+ public ServiceElement toElement() {
+ return this;
+ }
+
+ /* ************************************************************
+ * ServiceElement interface methods (the XML Element model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#setName(NCName)
+ */
+ public void setName(NCName name) {
+ fName = name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#setInterfaceName(javax.xml.namespace.QName)
+ */
+ public void setInterfaceName(QName qname) {
+ fInterfaceName = qname;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#getInterfaceName()
+ */
+ public QName getInterfaceName() {
+ return fInterfaceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#getInterfaceElement()
+ */
+ public InterfaceElement getInterfaceElement()
+ {
+ //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 interfac = (InterfaceElement)desc.getInterface(fInterfaceName);
+ return interfac;
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#addEndpointElement()
+ */
+ public EndpointElement addEndpointElement()
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ fEndpoints.add(endpoint);
+ endpoint.setParentElement(this);
+ return endpoint;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ServiceElement#getEndpointElements()
+ */
+ public EndpointElement[] getEndpointElements() {
+ EndpointElement[] array = new EndpointElement[fEndpoints.size()];
+ fEndpoints.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
+ * ************************************************************/
+
+ /*
+ * These package private accessors refer to the Description component
+ * in which this Service is contained (i.e. contained in its {services}
+ * 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;
+ }
+
+ public FragmentIdentifier getFragmentIdentifier() {
+ return new FragmentIdentifier(new ServicePart(fName));
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypeDefinitionImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypeDefinitionImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypeDefinitionImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,117 @@
+/**
+ * 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.TypeDefinition;
+
+import org.apache.woden.wsdl20.fragids.ElementDeclarationPart;
+import org.apache.woden.wsdl20.fragids.FragmentIdentifier;
+import org.apache.woden.wsdl20.fragids.TypeDefinitionPart;
+
+/**
+ * This class represents a TypeDefinition property of the Description component.
+ * It refers to a global type definition provided by the underlying type
+ * system (e.g. XML Schema)
+ *
+ * @author jkaputin@apache.org
+ */
+public class TypeDefinitionImpl implements TypeDefinition {
+
+ private QName fName = null;
+ private URI fSystem = null;
+ private String fContentModel = null;
+ private Object fContent = null;
+
+ /* ************************************************************
+ * TypeDefinition interface methods (the WSDL Component model)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.TypeDefinition#getName()
+ */
+ public QName getName()
+ {
+ return fName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.TypeDefinition#getSystem()
+ */
+ public URI getSystem()
+ {
+ return fSystem;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.TypeDefinition#getContentModel()
+ */
+ public String getContentModel()
+ {
+ return fContentModel;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.TypeDefinition#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 typeDefContent)
+ {
+ fContent = typeDefContent;
+ }
+
+ public FragmentIdentifier getFragmentIdentifier() {
+ if (fSystem == null | fSystem.toString().equals(WSDLReader.TYPE_XSD_2001)) {
+ return new FragmentIdentifier(new TypeDefinitionPart(fName));
+ } else {
+ return new FragmentIdentifier(new TypeDefinitionPart(fName, fSystem));
+ }
+ }
+
+ public String toString() {
+ return getFragmentIdentifier().toString();
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypesImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypesImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypesImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/TypesImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,320 @@
+/**
+ * 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.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.internal.schema.SchemaImpl;
+import org.apache.woden.schema.ImportedSchema;
+import org.apache.woden.schema.InlinedSchema;
+import org.apache.woden.schema.Schema;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
+/**
+ * This class represents the WSDL <types> element.
+ *
+ * TODO consider methods to get directly declared schemas vs getting all 'in-scope' schemas from the wsdl tree.
+ *
+ * @author jkaputin@apache.org
+ */
+public class TypesImpl extends DocumentableImpl
+ implements TypesElement
+{
+ private WSDLElement fParentElem = null;
+ private String fTypeSystem = null;
+ private List fSchemas = new Vector();
+
+ //TODO extension attributes and elements
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#setTypeSystem(java.lang.String)
+ */
+ public void setTypeSystem(String typeSystem)
+ {
+ fTypeSystem = typeSystem;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#getTypeSystem()
+ */
+ public String getTypeSystem()
+ {
+ return fTypeSystem;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#addSchema(org.apache.woden.schema.Schema)
+ */
+ public void addSchema(Schema schema)
+ {
+ if(schema != null) {
+ fSchemas.add(schema);
+ //reset flag so ComponentModelBuilder will rebuild the ElementDeclarations and TypeDefinitions
+ ((DescriptionImpl)getParentElement()).resetComponentsInitialized();
+ }
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#removeSchema(org.apache.woden.schema.Schema)
+ */
+ public void removeSchema(Schema schema)
+ {
+ fSchemas.remove(schema);
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#getSchemas()
+ */
+ public Schema[] getSchemas()
+ {
+ Schema[] array = new Schema[fSchemas.size()];
+ fSchemas.toArray(array);
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#getSchemas(java.net.URI)
+ */
+ public Schema[] getSchemas(URI namespace)
+ {
+ List schemas = new Vector();
+ Iterator i = fSchemas.iterator();
+
+ if(namespace != null)
+ {
+ while(i.hasNext()) {
+ Schema s = (Schema)i.next();
+ if(namespace.equals(s.getNamespace())) {
+ schemas.add(s);
+ }
+ }
+ }
+ else
+ {
+ //get schemas whose namespace is missing
+ while(i.hasNext()) {
+ Schema s = (Schema)i.next();
+ if(s.getNamespace() == null) {
+ schemas.add(s);
+ }
+ }
+ }
+
+ Schema[] array = new Schema[schemas.size()];
+ schemas.toArray(array);
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#getInlinedSchemas()
+ */
+ public InlinedSchema[] getInlinedSchemas()
+ {
+ List schemas = new Vector();
+ Iterator i = fSchemas.iterator();
+ while(i.hasNext()) {
+ Schema s = (Schema)i.next();
+ if(s instanceof InlinedSchema) {
+ schemas.add(s);
+ }
+ }
+
+ InlinedSchema[] array = new InlinedSchema[schemas.size()];
+ schemas.toArray(array);
+ return array;
+ }
+
+ /*
+ * @see org.apache.woden.wsdl20.xml.TypesElement#getImportedSchemas()
+ */
+ public ImportedSchema[] getImportedSchemas()
+ {
+ List schemas = new Vector();
+ Iterator i = fSchemas.iterator();
+ while(i.hasNext()) {
+ Schema s = (Schema)i.next();
+ if(s instanceof ImportedSchema) {
+ schemas.add(s);
+ }
+ }
+
+ ImportedSchema[] array = new ImportedSchema[schemas.size()];
+ schemas.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
+ * ************************************************************/
+
+ /*
+ * TODO decide if this helper method should be on the API, either as-is or replaced by method that returns all accessible schemas.
+ *
+ * Returns the schema element declaration identified by the QName,
+ * providing the element declaration is referenceable to the
+ * WSDL description (i.e. visible). This means it must exist in a
+ * Schema that has been inlined or resolved from a schema import
+ * within the <types> element according to the schema
+ * referenceability rules in the WSDL 2.0 spec.
+ * If the element declaration is not referenceable, null is returned.
+ * If validation is disabled, the referenceability rules do not apply
+ * so all schemas are considered referenceable by the WSDL.
+ *
+ * TODO tbd - @see org.apache.woden.wsdl20.xml.TypesElement#getElementDeclaration(javax.xml.namespace.QName)
+ */
+ public XmlSchemaElement getElementDeclaration(QName qname)
+ {
+ // Can't resolve the element if the QName is null.
+ if(qname == null)
+ return null;
+
+ XmlSchemaElement xmlSchemaElement = null;
+ List schemas = getReferenceableSchemaDefs(qname.getNamespaceURI());
+ if(schemas != null)
+ {
+ //search the schemas with this qname's namespace
+ Iterator i = schemas.iterator();
+ while(i.hasNext())
+ {
+ XmlSchema xmlSchema = (XmlSchema)i.next();
+ xmlSchemaElement = xmlSchema.getElementByName(qname);
+ if(xmlSchemaElement != null) {
+ break;
+ }
+ }
+ }
+ return xmlSchemaElement;
+ }
+
+ /*
+ * TODO decide if this helper method should be on the API, either as-is or replaced by method that returns all accessible schemas.
+ *
+ * Returns the schema type definition identified by the QName,
+ * providing the type definition is referenceable by the
+ * WSDL description (i.e. visible). This means it must exist in a
+ * Schema that has been inlined or resolved from a schema import
+ * within the <types> element according to the schema
+ * referenceability rules in the WSDL 2.0 spec.
+ * If the type definition is not referenceable, null is returned.
+ * If validation is disabled, the referenceability rules do not apply
+ * so all schemas are considered referenceable by the WSDL.
+ *
+ * TODO tbd - @see org.apache.woden.wsdl20.xml.TypesElement#getTypeDefinition(javax.xml.namespace.QName)
+ */
+ public XmlSchemaType getTypeDefinition(QName qname)
+ {
+ XmlSchemaType xmlSchemaType = null;
+ if(qname != null)
+ {
+ List schemaRefs = getReferenceableSchemaDefs(qname.getNamespaceURI());
+ if(schemaRefs != null)
+ {
+ //search the schemas with this qname's namespace
+ Iterator i = schemaRefs.iterator();
+ while(i.hasNext())
+ {
+ XmlSchema xmlSchema = (XmlSchema)i.next();
+ xmlSchemaType = xmlSchema.getTypeByName(qname);
+ if(xmlSchemaType != null) {
+ break;
+ }
+ }
+ }
+ }
+ return xmlSchemaType;
+ }
+
+ /*
+ * Returns a List of XmlSchema objects for all schemas that are referenceable
+ * by the containing WSDL. Examples of schemas that are not referenceable include
+ * schemas without a target namespace or schemas resolved from a schema import
+ * whose target namespace does not match the imported namespace. Referenceability
+ * is determined by validation.
+ * NOTE: This is an implementation-only method used to build the ElementDeclarations
+ * components (i.e. it is not an API method). If it is required on the API it must be
+ * changed to use a type safe return value.
+ *
+ * TODO t.b.c. remove if made redundant by WODEN-123
+ */
+ private List getReferenceableSchemaDefs()
+ {
+ List schemas = new Vector();
+ Iterator i = fSchemas.iterator();
+ while(i.hasNext())
+ {
+ SchemaImpl s = (SchemaImpl)i.next();
+ if(s.isReferenceable() &&
+ s.getSchemaDefinition() != null)
+ {
+ schemas.add(s.getSchemaDefinition());
+ }
+ }
+ return schemas;
+ }
+
+ /*
+ * Return a Lists of XmlSchema for all schemas with the specified target namespace
+ * or import namespace that are referenceable by the WSDL.
+ * Note, this method requires a non-null namespace argument.
+ *
+ * TODO t.b.d. remove the notion of referenceability - just get ALL schemas?
+ */
+ private List getReferenceableSchemaDefs(String namespace)
+ {
+
+ List schemas = new Vector();
+ if(namespace != null)
+ {
+ Iterator i = fSchemas.iterator();
+ while(i.hasNext())
+ {
+ SchemaImpl s = (SchemaImpl)i.next();
+ if(s.isReferenceable() &&
+ namespace.equals(s.getNamespaceAsString()) &&
+ s.getSchemaDefinition() != null)
+ {
+ schemas.add(s.getSchemaDefinition());
+ }
+ }
+ }
+ return schemas;
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLComponentImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLComponentImpl.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 java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import org.apache.woden.wsdl20.WSDLComponent;
+import org.apache.woden.wsdl20.extensions.BaseComponentExtensionContext;
+import org.apache.woden.wsdl20.extensions.ComponentExtensionContext;
+import org.apache.woden.wsdl20.extensions.ExtensionProperty;
+
+/**
+ * All classes implementing the WSDL 2.0 Component and Element
+ * model interfaces directly or indirectly extend this
+ * abstract class. It implements the WSDL20Component interface
+ * which just provides a common reference for objects from the WSDL 2.0
+ * Component API. This class also inherits common behaviour for
+ * WSDL Elements from WSDLElementImpl, which in turn provides a common
+ * reference for objects from the the WSDL 2.0 Element API.
+ *
+ * @author jkaputin@apache.org
+ */
+public abstract class WSDLComponentImpl extends DocumentableImpl
+ implements WSDLComponent
+{
+ private Map fCompExtensionContexts = new HashMap(); //key=extNS, value=ComponentExtensionsContext
+
+ /* ************************************************************
+ * WSDLComponent interface methods (i.e. WSDL Component API)
+ * ************************************************************/
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#equals(WSDLComponent)
+ *
+ * TODO implement this method in all concrete component classes and make this
+ * implementation abstract or throw UnsupportedExc.
+ */
+ public boolean equals(WSDLComponent comp)
+ {
+ return super.equals(comp);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#setComponentExtensionContext(java.net.URI, org.apache.woden.wsdl20.extensions.ComponentExtensionsContext)
+ */
+ public void setComponentExtensionContext(URI extNamespace, ComponentExtensionContext compExtCtx) {
+
+ if(extNamespace == null) {
+ String msg = getWsdlContext().errorReporter.getFormattedMessage("WSDL023", null);
+ throw new NullPointerException(msg);
+ }
+
+ if(compExtCtx != null) {
+ fCompExtensionContexts.put(extNamespace.toString(), compExtCtx);
+ } else {
+ fCompExtensionContexts.remove(extNamespace.toString());
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.WSDLComponent#getComponentExtensionContext(java.net.URI)
+ */
+ public ComponentExtensionContext getComponentExtensionContext(URI extNamespace) {
+ if(extNamespace == null) {
+ return null;
+ }
+ return (ComponentExtensionContext) fCompExtensionContexts.get(extNamespace.toString());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.PropertyExtensible#getExtensionProperties()
+ */
+ public ExtensionProperty[] getExtensionProperties() {
+ int i, len;
+ List properties = new Vector();
+ Collection compExtCtxs = fCompExtensionContexts.values();
+ Iterator it = compExtCtxs.iterator();
+ while(it.hasNext()) {
+ BaseComponentExtensionContext compExtCtx = (BaseComponentExtensionContext)it.next();
+ ExtensionProperty[] extProps = compExtCtx.getProperties();
+ len = extProps.length;
+ for(i=0; i<len; i++) {
+ properties.add(extProps[i]);
+ }
+ }
+
+ ExtensionProperty[] array = new ExtensionProperty[properties.size()];
+ properties.toArray(array);
+ return array;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.PropertyExtensible#getExtensionProperties(java.net.URI)
+ */
+ public ExtensionProperty[] getExtensionProperties(URI extNamespace) {
+ if(extNamespace == null) {
+ return new ExtensionProperty[] {};
+ }
+
+ ComponentExtensionContext compExtCtx = getComponentExtensionContext(extNamespace);
+ if(compExtCtx == null) {
+ return new ExtensionProperty[] {};
+ }
+
+ return compExtCtx.getProperties();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.PropertyExtensible#getExtensionProperty(java.net.URI, java.lang.String)
+ */
+ public ExtensionProperty getExtensionProperty(URI extNamespace, String propertyName) {
+ if(extNamespace == null || propertyName == null) {
+ return null;
+ }
+
+ ComponentExtensionContext compExtCtx = getComponentExtensionContext(extNamespace);
+ if(compExtCtx == null) {
+ return null;
+ }
+
+ return compExtCtx.getProperty(propertyName);
+ }
+
+ /* ************************************************************
+ * Non-API implementation methods
+ * ************************************************************/
+
+ /*
+ * Check if a component already exists in a list of those components. Used when
+ * retrieving sets of components to de-duplicate logically equivalent components.
+ */
+ protected boolean containsComponent(WSDLComponent comp, List components)
+ {
+ for(Iterator i=components.iterator(); i.hasNext(); )
+ {
+ WSDLComponent tempComp = (WSDLComponent)i.next();
+ if(tempComp.equals(comp)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public String toString() {
+ return getFragmentIdentifier().toString();
+ }
+
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLElementImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLElementImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLElementImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLElementImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,219 @@
+/**
+ * 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.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.internal.WSDLContext;
+import org.apache.woden.internal.wsdl20.extensions.AttributeExtensibleImpl;
+import org.apache.woden.internal.wsdl20.extensions.ElementExtensibleImpl;
+import org.apache.woden.types.NamespaceDeclaration;
+import org.apache.woden.wsdl20.extensions.ExtensionElement;
+import org.apache.woden.wsdl20.xml.NestedElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+import org.apache.woden.xml.XMLAttr;
+
+/**
+ * This abstract class defines the behaviour common to all WSDL elements.
+ * That is, it implements support for extension attributes and elements.
+ * This interface can be used as a common reference for all WSDL elements
+ * represented by the Element API.
+ *
+ * @author jkaputin@apache.org
+ */
+public class WSDLElementImpl implements WSDLElement
+{
+ private static final String emptyString = "".intern();
+ private AttributeExtensibleImpl fAttrExt = new AttributeExtensibleImpl();
+ private ElementExtensibleImpl fElemExt = new ElementExtensibleImpl();
+ private Map namespaceToPrefixMap = new HashMap();
+ private Map prefixToNamespaceMap = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr)
+ */
+ public void setExtensionAttribute(QName attrType, XMLAttr attr)
+ {
+ fAttrExt.setExtensionAttribute(attrType, attr);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName)
+ */
+ public XMLAttr getExtensionAttribute(QName attrType)
+ {
+ return fAttrExt.getExtensionAttribute(attrType);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributesForNamespace(java.net.URI)
+ */
+ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace)
+ {
+ return fAttrExt.getExtensionAttributesForNamespace(namespace);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes()
+ */
+ public XMLAttr[] getExtensionAttributes()
+ {
+ return fAttrExt.getExtensionAttributes();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(java.net.URI)
+ */
+ public boolean hasExtensionAttributesForNamespace(URI namespace)
+ {
+ return fAttrExt.hasExtensionAttributesForNamespace(namespace);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.ElementExtensible#addExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement)
+ */
+ public void addExtensionElement(ExtensionElement extEl)
+ {
+ fElemExt.addExtensionElement(extEl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.ElementExtensible#removeExtensionElement(org.apache.woden.wsdl20.extensions.ExtensionElement)
+ */
+ public void removeExtensionElement(ExtensionElement extEl)
+ {
+ fElemExt.removeExtensionElement(extEl);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElements()
+ */
+ public ExtensionElement[] getExtensionElements()
+ {
+ return fElemExt.getExtensionElements();
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.ElementExtensible#getExtensionElementsOfType(javax.xml.namespace.QName)
+ */
+ public ExtensionElement[] getExtensionElementsOfType(QName elemType)
+ {
+ return fElemExt.getExtensionElementsOfType(elemType);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.ElementExtensible#hasExtensionElementsForNamespace(java.net.URI)
+ */
+ public boolean hasExtensionElementsForNamespace(URI namespace)
+ {
+ return fElemExt.hasExtensionElementsForNamespace(namespace);
+ }
+
+ //package private
+ WSDLContext getWsdlContext() {
+ return getWsdlContext(this);
+ }
+
+ static private WSDLContext getWsdlContext(WSDLElement wElem) {
+ if (wElem instanceof NestedElement) {
+ WSDLElement parent = ((NestedElement) wElem).getParentElement();
+ return getWsdlContext(parent);
+ }
+
+ //This is not a nested element, so the WSDL context is in this element, at the top of the tree.
+ //This element will override the getWsdlContext() method defined in WSDLElementImpl.
+ return ((WSDLElementImpl)wElem).getWsdlContext();
+ }
+
+ public void addNamespace(String prefix, URI namespace) {
+ prefix = (prefix != null) ? prefix : emptyString;
+ if (namespace == null) {
+ removeNamespace(prefix);
+ } else {
+ namespaceToPrefixMap.put(namespace, prefix);
+ prefixToNamespaceMap.put(prefix, namespace);
+ }
+ }
+
+ public URI removeNamespace(String prefix) {
+ prefix = (prefix != null) ? prefix : emptyString;
+ URI namespaceURI = (URI)prefixToNamespaceMap.remove(prefix);
+ namespaceToPrefixMap.remove(namespaceURI);
+ return namespaceURI;
+ }
+
+ public String getNamespacePrefix(URI namespace) {
+ //See if the prefix is local.
+ String prefix = (String)namespaceToPrefixMap.get(namespace);
+ if (prefix == null && this instanceof NestedElement) { //If not call parents to find prefix if I'm nested.
+ return ((NestedElement)this).getParentElement().getNamespacePrefix(namespace);
+ } else { //Otherwise return the found prefix or null.
+ return prefix;
+ }
+ }
+
+ public URI getNamespaceURI(String prefix) {
+ //See if the prefix is local.
+ prefix = (prefix != null) ? prefix : emptyString;
+ URI namespace = (URI)prefixToNamespaceMap.get(prefix);
+ if (namespace == null && this instanceof NestedElement) { //If not call parents to find prefix if I'm nested.
+ return ((NestedElement)this).getParentElement().getNamespaceURI(prefix);
+ } else { //Otherwise return the found namespace or null.
+ return namespace;
+ }
+ }
+
+ public NamespaceDeclaration[] getInScopeNamespaces() {
+ ArrayList namespaces = addInScopeNamespaces(new ArrayList());
+ return (NamespaceDeclaration[])namespaces.toArray(new NamespaceDeclaration[namespaces.size()]);
+ }
+
+ private ArrayList addInScopeNamespaces(ArrayList namespaces) {
+ //Add my namespaces.
+ Iterator it = namespaceToPrefixMap.keySet().iterator();
+ while(it.hasNext()){
+ URI namespace = (URI)it.next();
+ namespaces.add(new NamespaceDeclaration((String)namespaceToPrefixMap.get(namespace), namespace));
+ }
+ //Add my parent namespaces if I'm a child.
+ if (this instanceof NestedElement) {
+ return ((WSDLElementImpl)((NestedElement)this).getParentElement()).addInScopeNamespaces(namespaces);
+ } else {
+ return namespaces;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.WSDLElement#getLocalNamespaceDeclarations()
+ */
+ public NamespaceDeclaration[] getDeclaredNamespaces() {
+ ArrayList namespaces = new ArrayList();
+ Iterator it = namespaceToPrefixMap.keySet().iterator();
+ while(it.hasNext()){
+ URI namespace = (URI)it.next();
+ namespaces.add(new NamespaceDeclaration((String)namespaceToPrefixMap.get(namespace), namespace));
+ }
+ return (NamespaceDeclaration[])namespaces.toArray(new NamespaceDeclaration[namespaces.size()]);
+ }
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/WSDLReferenceImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,104 @@
+/**
+ * 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.List;
+import java.util.Vector;
+
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+import org.apache.woden.wsdl20.xml.DocumentationElement;
+import org.apache.woden.wsdl20.xml.WSDLElement;
+
+/**
+ * This abstract class defines the common behaviour for referencing WSDL
+ * documents via the <wsdl:import> and <wsdl:include> elements.
+ * It is extended by the concrete implementation classes for those two elements.
+ *
+ * TODO consider whether to expose a WSDLReferenceElement interface on the API too
+ * to provide a common handle for import and include elements (is there a use case?).
+ *
+ * @author jkaputin@apache.org
+ */
+public abstract class WSDLReferenceImpl extends DocumentableImpl
+{
+ private List fDocumentationElements = new Vector();
+ private URI fLocation = null;
+ private DescriptionElement fDescriptionElement = null;
+ private WSDLElement fParentElem = null;
+
+ /*
+ * 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-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ImportElement#setLocation(java.net.URI)
+ */
+ public void setLocation(URI locURI) {
+ fLocation = locURI;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ImportElement#getLocation()
+ */
+ public URI getLocation() {
+ return fLocation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ImportElement#setDescriptionElement(org.apache.woden.wsdl20.xml.DescriptionElement)
+ */
+ public void setDescriptionElement(DescriptionElement desc) {
+ fDescriptionElement = desc;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.ImportElement#getDescriptionElement()
+ */
+ public DescriptionElement getDescriptionElement() {
+ return fDescriptionElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.xml.DocumentableElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement)
+ */
+ public void addDocumentationElement(DocumentationElement docEl)
+ {
+ if(docEl != null) {
+ fDocumentationElements.add(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/assertions/Description1001.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1001.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1001.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1001.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,79 @@
+/**
+ * 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.assertions;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.WodenContext;
+import org.apache.woden.wsdl20.xml.DescriptionElement;
+
+/**
+ * This class represents assertion Description-1001 from the WSDL 2.0 specification.
+ * For details about this assertion see:
+ * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Description-1001
+ *
+ * @author John Kaputin (jkaputin@apache.org)
+ * @author Lawrence Mandel (lmandel@apache.org)
+ */
+public class Description1001 implements Assertion {
+
+ /**
+ * A list of URI schemes for which this assertion will attempt to check if
+ * the target namespace is dereferencable.
+ */
+ private static String searchableSchemes = "http,ftp,file";
+
+ public String getId() {
+ return "Description-1001".intern();
+ }
+
+ public void validate(Object target, WodenContext wodenCtx) throws WSDLException {
+ DescriptionElement descElem = (DescriptionElement) target;
+ URI tns = descElem.getTargetNamespace();
+
+ try {
+ URI resolvedUri = wodenCtx.getUriResolver().resolveURI(tns);
+ URI uri = resolvedUri != null ? resolvedUri : tns;
+ String scheme = uri.getScheme();
+
+ // Only check if the scheme is a type that we can locate.
+ // TODO: See if the searchable schemes should be extensible.
+ Object o = null;
+ if(searchableSchemes.indexOf(scheme)!=-1) {
+ URL url = uri.toURL();
+ o = url.getContent();
+ }
+ if(o == null) {
+ throw new Exception();
+ }
+ } catch (WSDLException e2) {
+ // A WSDLException may be thrown due to a problem with the URI resolver so we should report this exception.
+ throw e2;
+ } catch (Exception e) {
+ // Any other exception including IOExceptoin, MalformedURLException, UnknownHostException, and
+ // FileNotFoundException means that the namespace was not resolvable.
+ wodenCtx.getErrorReporter().reportError(
+ new ErrorLocatorImpl(), getId(), new Object[] {tns}, ErrorReporter.SEVERITY_WARNING);
+ }
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1002.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1002.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1002.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1002.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,17 @@
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.WodenContext;
+
+public class Description1002 implements Assertion {
+
+ public String getId() {
+ return "Description-1002".intern();
+ }
+
+ public void validate(Object target, WodenContext wodenCtx) throws WSDLException {
+ // TODO Auto-generated method stub
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1003.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1003.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1003.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Description1003.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,17 @@
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.WSDLException;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.WodenContext;
+
+public class Description1003 implements Assertion {
+
+ public String getId() {
+ return "Description-1003".intern();
+ }
+
+ public void validate(Object target, WodenContext wodenCtx) throws WSDLException {
+ // TODO Auto-generated method stub
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1009.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1009.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1009.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1009.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,79 @@
+/**
+ * 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.assertions;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.WodenContext;
+
+/**
+ * This class represents assertion Interface-1009 from the WSDL 2.0 specification.
+ * For details about this assertion see:
+ * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Interface-1009
+ *
+ * @author Lawrence Mandel (lmandel@apache.org)
+ */
+public class Interface1009 implements Assertion {
+
+ public final static String ID = "Interface-1009".intern();
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, org.apache.woden.wsdl20.validation.WodenContext)
+ */
+ public void validate(Object target, WodenContext wodenCtx) throws WSDLException {
+ Interface interfac = (Interface)target;
+ Interface[] extendedInterfaces = interfac.getExtendedInterfaces();
+ if(containsInterface(interfac, extendedInterfaces)) {
+ try {
+ wodenCtx.getErrorReporter().reportError(new ErrorLocatorImpl(), ID , new Object[]{interfac.getName()}, ErrorReporter.SEVERITY_ERROR);
+ }catch(WSDLException e) {
+ //TODO: Log problem reporting error.
+ }
+ }
+ }
+
+ /**
+ * Check whether the specified interface is in the list of extended interfaces.
+ *
+ * @param interfac The interface that should be checked to see if it is in the list of exteneded interfaces.
+ * @param extendedInterfaces An array of interfaces representing the list of extended interfaces.
+ * @return true if the interface is in the list of extended interfaces, false otherwise.
+ */
+ private boolean containsInterface(Interface interfac, Interface[] extendedInterfaces) {
+ boolean foundInterface = false;
+
+ int numExtInterfaces = extendedInterfaces.length;
+ for(int i = 0; i < numExtInterfaces && !foundInterface; i++) {
+ if(interfac.equals(extendedInterfaces[i]))
+ foundInterface = true;
+ else if(containsInterface(interfac, extendedInterfaces[i].getExtendedInterfaces()))
+ foundInterface = true;
+ }
+ return foundInterface;
+ }
+
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1010.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1010.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1010.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/assertions/Interface1010.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,75 @@
+/**
+ * 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.assertions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.WSDLException;
+import org.apache.woden.internal.ErrorLocatorImpl;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.apache.woden.wsdl20.validation.WodenContext;
+
+/**
+ * This class represents assertion Interface-1010 from the WSDL 2.0 specification.
+ * For details about this assertion see:
+ * http://www.w3.org/TR/2007/REC-wsdl20-20070626/#Interface-1010
+ *
+ * @author Lawrence Mandel (lmandel@apache.org)
+ */
+public class Interface1010 implements Assertion {
+
+ public final static String ID = "Interface-1010".intern();
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.validation.Assertion#getAssertionID()
+ */
+ public String getId() {
+ return ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.validation.Assertion#validate(java.lang.Object, org.apache.woden.wsdl20.validation.WodenContext)
+ */
+ public void validate(Object target, WodenContext wodenCtx) throws WSDLException {
+ Description desc = (Description)target;
+ Interface[] interfaces = desc.getInterfaces();
+
+ List names = new ArrayList();
+ int numInterfaces = interfaces.length;
+ for(int i = 0; i < numInterfaces; i++) {
+ QName name = interfaces[i].getName();
+ if(name == null)
+ continue;
+ if(names.contains(name)) {
+ try {
+ wodenCtx.getErrorReporter().reportError(new ErrorLocatorImpl(), ID, new Object[]{name}, ErrorReporter.SEVERITY_ERROR);
+ }catch(WSDLException e) {
+ //TODO: Log problem reporting error.
+ }
+ }
+ else {
+ names.add(name);
+ }
+ }
+ }
+}
Added: webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.java
URL: http://svn.apache.org/viewvc/webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.java?rev=809831&view=auto
==============================================================================
--- webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.java (added)
+++ webservices/woden/trunk/java/woden-commons/src/main/java/org/apache/woden/internal/wsdl20/extensions/AttributeExtensibleImpl.java Tue Sep 1 05:49:02 2009
@@ -0,0 +1,133 @@
+/**
+ * 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.extensions;
+
+import java.net.URI;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.wsdl20.extensions.AttributeExtensible;
+import org.apache.woden.xml.XMLAttr;
+
+/**
+ * Common code for handling extension attributes.
+ * Can be reused by inheritance or by delegation.
+ *
+ * @author jkaputin@ws.apache.org
+ */
+public class AttributeExtensibleImpl implements AttributeExtensible
+{
+ private Map fExtAttributes = new HashMap();
+
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#setExtensionAttribute(javax.xml.namespace.QName, org.apache.woden.xml.XMLAttr)
+ */
+ public void setExtensionAttribute(QName attrType, XMLAttr attr)
+ {
+ if(attrType != null) //TODO throw IllegArgExc if it is null?
+ {
+ if(attr != null) {
+ fExtAttributes.put(attrType, attr);
+ } else {
+ fExtAttributes.remove(attrType);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttribute(javax.xml.namespace.QName)
+ */
+ public XMLAttr getExtensionAttribute(QName attrType)
+ {
+ //TODO throw IllegArgExc if it is null?
+ if(attrType != null) {
+ return (XMLAttr)fExtAttributes.get(attrType);
+ } else {
+ return null;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributesForNamespace(java.net.URI)
+ */
+ public XMLAttr[] getExtensionAttributesForNamespace(URI namespace)
+ {
+ if(namespace != null)
+ {
+ String extensionNS = namespace.toString();
+ List list = new Vector();
+ Collection coll = fExtAttributes.keySet();
+ for(Iterator i = coll.iterator(); i.hasNext();)
+ {
+ QName qn = (QName)i.next();
+ if(qn.getNamespaceURI().equals(extensionNS))
+ {
+ list.add(fExtAttributes.get(qn));
+ }
+ }
+ XMLAttr[] array = new XMLAttr[list.size()];
+ list.toArray(array);
+ return array;
+ }
+ else
+ {
+ return new XMLAttr[0];
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#getExtensionAttributes()
+ */
+ public XMLAttr[] getExtensionAttributes()
+ {
+ Collection coll = fExtAttributes.values();
+ XMLAttr[] array = new XMLAttr[coll.size()];
+ coll.toArray(array);
+ return array;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.woden.wsdl20.extensions.AttributeExtensible#hasExtensionAttributesForNamespace(javax.net.URI)
+ */
+ public boolean hasExtensionAttributesForNamespace(URI namespace)
+ {
+ boolean result = false;
+ if(namespace != null)
+ {
+ String extensionNS = namespace.toString();
+ Collection coll = fExtAttributes.keySet();
+ for(Iterator i = coll.iterator(); i.hasNext();)
+ {
+ QName qn = (QName)i.next();
+ if(extensionNS.equals(qn.getNamespaceURI()))
+ {
+ result = true;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org