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 jk...@apache.org on 2005/10/29 04:26:40 UTC
svn commit: r329353 - in
/incubator/woden/java/src/org/apache/woden/internal: DOMWSDLReader.java
wsdl20/InterfaceMessageReferenceImpl.java
Author: jkaputin
Date: Fri Oct 28 19:26:32 2005
New Revision: 329353
URL: http://svn.apache.org/viewcvs?rev=329353&view=rev
Log:
Added null checks to parseInterfaceFault and
parseInterfaceMessageReference. Completed implementation
and parsing of InterfaceMessageReferenceElement
Modified:
incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
Modified: incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java?rev=329353&r1=329352&r2=329353&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/DOMWSDLReader.java Fri Oct 28 19:26:32 2005
@@ -43,13 +43,13 @@
import org.apache.woden.schema.SchemaImport;
import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.apache.woden.wsdl20.xml.DocumentationElement;
+import org.apache.woden.wsdl20.xml.FaultReferenceElement;
import org.apache.woden.wsdl20.xml.FeatureElement;
import org.apache.woden.wsdl20.xml.ImportElement;
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.InterfaceMessageReferenceElement;
-import org.apache.woden.wsdl20.xml.FaultReferenceElement;
+import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
import org.apache.woden.wsdl20.xml.PropertyElement;
import org.apache.woden.wsdl20.xml.TypesElement;
import org.apache.ws.commons.schema.XmlSchema;
@@ -389,17 +389,20 @@
}
String element = DOMUtils.getAttribute(faultEl, Constants.ATTR_ELEMENT);
- try {
- QName qname = DOMUtils.getQName(element, faultEl, desc);
- fault.setElement(qname);
- } catch (WSDLException e) {
- //report the parse-time error and let the validator handle it.
- getErrorReporter().reportError(
- new ErrorLocatorImpl(), //TODO line&col nos.
- "WSDL504",
- new Object[] {element, "fault"},
- ErrorReporter.SEVERITY_ERROR);
- //TODO if validation is off and continue-on-error is off, terminate here
+ if(element != null)
+ {
+ try {
+ QName qname = DOMUtils.getQName(element, faultEl, desc);
+ fault.setElement(qname);
+ } catch (WSDLException e) {
+ //report the parse-time error and let the validator handle it.
+ getErrorReporter().reportError(
+ new ErrorLocatorImpl(), //TODO line&col nos.
+ "WSDL504",
+ new Object[] {element, "fault"},
+ ErrorReporter.SEVERITY_ERROR);
+ //TODO if validation is off and continue-on-error is off, terminate here
+ }
}
//TODO extension attributes
@@ -427,7 +430,7 @@
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
-
+
return fault;
}
@@ -510,19 +513,61 @@
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
-
+
return oper;
}
private InterfaceMessageReferenceElement parseInterfaceMessageReference(
- Element inputEl,
+ Element messageEl,
DescriptionElement desc)
+ throws WSDLException
{
- InterfaceMessageReferenceElement input = desc.createInterfaceMessageReferenceElement();
+ InterfaceMessageReferenceElement message = desc.createInterfaceMessageReferenceElement();
+
+ message.setMessageLabel(DOMUtils.getAttribute(messageEl, Constants.ATTR_MESSAGE_LABEL));
- input.setMessageLabel(DOMUtils.getAttribute(inputEl, Constants.ATTR_MESSAGE_LABEL));
+ String element = DOMUtils.getAttribute(messageEl, Constants.ATTR_ELEMENT);
+ if(element != null)
+ {
+ try {
+ QName qname = DOMUtils.getQName(element, messageEl, desc);
+ message.setElement(qname);
+ } catch (WSDLException e) {
+ getErrorReporter().reportError(
+ new ErrorLocatorImpl(), //TODO line&col nos.
+ "WSDL504",
+ new Object[] {element, messageEl.getLocalName()},
+ ErrorReporter.SEVERITY_ERROR);
+ }
+ }
+
+ //TODO extension attributes
+
+ Element tempEl = DOMUtils.getFirstChildElement(messageEl);
+
+ while (tempEl != null)
+ {
+ if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl))
+ {
+ message.addDocumentationElement(parseDocumentation(tempEl, desc));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_FEATURE, tempEl))
+ {
+ message.addFeatureElement(parseFeature(tempEl, desc));
+ }
+ else if (QNameUtils.matches(Constants.Q_ELEM_PROPERTY, tempEl))
+ {
+ message.addPropertyElement(parseProperty(tempEl, desc));
+ }
+ else
+ {
+ //TODO extension elements
+ }
+
+ tempEl = DOMUtils.getNextSiblingElement(tempEl);
+ }
- return null; //TODO
+ return message;
}
private FaultReferenceElement parseInterfaceFaultReference(
Modified: incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java?rev=329353&r1=329352&r2=329353&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java (original)
+++ incubator/woden/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java Fri Oct 28 19:26:32 2005
@@ -15,11 +15,15 @@
*/
package org.apache.woden.internal.wsdl20;
+import java.util.List;
+import java.util.Vector;
+
import javax.xml.namespace.QName;
import org.apache.woden.wsdl20.Component;
import org.apache.woden.wsdl20.ElementDeclaration;
import org.apache.woden.wsdl20.Feature;
+import org.apache.woden.wsdl20.Interface;
import org.apache.woden.wsdl20.InterfaceMessageReference;
import org.apache.woden.wsdl20.Property;
import org.apache.woden.wsdl20.xml.DocumentationElement;
@@ -37,134 +41,156 @@
InterfaceMessageReference,
InterfaceMessageReferenceElement
{
+ //WSDL Component model data
+ private String fMessageLabel = null; //TODO check String correct, not URI
+ private String fDirection = null;
+ private String fMessageContentModel = null;
+ private ElementDeclaration fElementDeclaration = null;
+ private List fFeatures = new Vector();
+ private List fProperties = new Vector();
+ private Interface fParent = null;
+
+ //XML Element model data
+ private QName fElement = null;
+ private List fFeatureElements = new Vector();
+ private List fPropertyElements = new Vector();
+ private List fDocumentationElements = new Vector();
+
+ /* ************************************************************
+ * InterfaceMessageReference methods (the WSDL Component model)
+ * ************************************************************/
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.InterfaceMessageReference#getMessageLabel()
* @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getMessageLabel()
*/
public String getMessageLabel() {
- // TODO Auto-generated method stub
- return null;
+ return fMessageLabel;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.InterfaceMessageReference#getDirection()
*/
public String getDirection() {
- // TODO Auto-generated method stub
- return null;
+ return fDirection;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.InterfaceMessageReference#getMessageContentModel()
*/
public String getMessageContentModel() {
- // TODO Auto-generated method stub
- return null;
+ return fMessageContentModel;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.InterfaceMessageReference#getElementDeclaration()
*/
public ElementDeclaration getElementDeclaration() {
- // TODO Auto-generated method stub
- return null;
+ return fElementDeclaration;
}
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setMessageLabel(java.lang.String)
+ * @see org.apache.woden.wsdl20.ConfigurableComponent#getFeatures()
*/
- public void setMessageLabel(String msgLabel) {
- // TODO Auto-generated method stub
-
+ public Feature[] getFeatures()
+ {
+ Feature[] array = new Feature[fFeatures.size()];
+ fFeatures.toArray(array);
+ return array;
}
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setElement(javax.xml.namespace.QName)
+ * @see org.apache.woden.wsdl20.ConfigurableComponent#getProperties()
*/
- public void setElement(QName element) {
- // TODO Auto-generated method stub
-
+ public Property[] getProperties()
+ {
+ Property[] array = new Property[fProperties.size()];
+ fProperties.toArray(array);
+ return array;
}
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getElement()
+ * @see org.apache.woden.wsdl20.NestedComponent#getParent()
*/
- public QName getElement() {
- // TODO Auto-generated method stub
- return null;
+ public Component getParent()
+ {
+ return fParent;
}
-
+
+ /* ************************************************************
+ * InterfaceMessageReferenceElement methods (the XML Element model)
+ * ************************************************************/
+
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.NestedComponent#getParent()
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setMessageLabel(java.lang.String)
*/
- public Component getParent() {
- // TODO Auto-generated method stub
- return null;
+ public void setMessageLabel(String msgLabel) {
+ fMessageLabel = msgLabel;
}
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.ConfigurableComponent#getFeatures()
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#setElement(javax.xml.namespace.QName)
*/
- public Feature[] getFeatures() {
- // TODO Auto-generated method stub
- return null;
+ public void setElement(QName element) {
+ fElement = element;
}
/* (non-Javadoc)
- * @see org.apache.woden.wsdl20.ConfigurableComponent#getProperties()
+ * @see org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement#getElement()
*/
- public Property[] getProperties() {
- // TODO Auto-generated method stub
- return null;
+ public QName getElement() {
+ return fElement;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.DocumentableElement#addDocumentationElement(org.apache.woden.wsdl20.xml.DocumentationElement)
*/
public void addDocumentationElement(DocumentationElement docEl) {
- // TODO Auto-generated method stub
-
+ fDocumentationElements.add(docEl);
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.DocumentableElement#getDocumentationElements()
*/
- public DocumentationElement[] getDocumentationElements() {
- // TODO Auto-generated method stub
- return null;
+ public DocumentationElement[] getDocumentationElements()
+ {
+ DocumentationElement[] array = new DocumentationElement[fDocumentationElements.size()];
+ fDocumentationElements.toArray(array);
+ return array;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.ConfigurableElement#addFeatureElement(org.apache.woden.wsdl20.xml.FeatureElement)
*/
public void addFeatureElement(FeatureElement feature) {
- // TODO Auto-generated method stub
-
+ fFeatureElements.add(feature);
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.ConfigurableElement#getFeatureElements()
*/
- public FeatureElement[] getFeatureElements() {
- // TODO Auto-generated method stub
- return null;
+ public FeatureElement[] getFeatureElements()
+ {
+ FeatureElement[] array = new FeatureElement[fFeatureElements.size()];
+ fFeatureElements.toArray(array);
+ return array;
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.ConfigurableElement#addPropertyElement(org.apache.woden.wsdl20.xml.PropertyElement)
*/
public void addPropertyElement(PropertyElement property) {
- // TODO Auto-generated method stub
-
+ fPropertyElements.add(property);
}
/* (non-Javadoc)
* @see org.apache.woden.wsdl20.xml.ConfigurableElement#getPropertyElements()
*/
- public PropertyElement[] getPropertyElements() {
- // TODO Auto-generated method stub
- return null;
+ public PropertyElement[] getPropertyElements()
+ {
+ PropertyElement[] array = new PropertyElement[fPropertyElements.size()];
+ fPropertyElements.toArray(array);
+ return array;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org