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 ry...@apache.org on 2006/07/05 01:01:37 UTC
svn commit: r419116 [1/2] - in /incubator/woden/java: ant-test/
src/org/apache/woden/ant/
Author: ryman
Date: Tue Jul 4 16:01:36 2006
New Revision: 419116
URL: http://svn.apache.org/viewvc?rev=419116&view=rev
Log:
WODEN-41
Refactored component model writers per namespace.
Regenerated test results - no change.
Added:
incubator/woden/java/src/org/apache/woden/ant/CmBaseWriter.java
incubator/woden/java/src/org/apache/woden/ant/CmExtensionsWriter.java
incubator/woden/java/src/org/apache/woden/ant/CmHttpWriter.java
incubator/woden/java/src/org/apache/woden/ant/CmRpcWriter.java
incubator/woden/java/src/org/apache/woden/ant/CmSoapWriter.java
incubator/woden/java/src/org/apache/woden/ant/CmWriter.java
incubator/woden/java/src/org/apache/woden/ant/NamespaceWriter.java
Modified:
incubator/woden/java/ant-test/build.xml
incubator/woden/java/ant-test/documents-good-report.xml
incubator/woden/java/ant-test/test-suite-results.zip
incubator/woden/java/src/org/apache/woden/ant/WsdlCm.java
incubator/woden/java/src/org/apache/woden/ant/XMLWriter.java
Modified: incubator/woden/java/ant-test/build.xml
URL: http://svn.apache.org/viewvc/incubator/woden/java/ant-test/build.xml?rev=419116&r1=419115&r2=419116&view=diff
==============================================================================
--- incubator/woden/java/ant-test/build.xml (original)
+++ incubator/woden/java/ant-test/build.xml Tue Jul 4 16:01:36 2006
@@ -25,7 +25,7 @@
<property name="desc.dir" location="${woden.dir}/../desc" />
<property name="test-suite.dir" location="${desc.dir}/test-suite" />
<property name="xsd.dir" location="${test-suite.dir}/interchange" />
- <property name="xmlcatalog.dir" location="${test-suite.dir}/xmlcatalog"/>
+ <property name="xmlcatalog.dir" location="${test-suite.dir}/xmlcatalog" />
<taskdef name="validatewsdl20" classname="org.apache.woden.ant.ValidateWSDL20" classpath="${lib.dir}/woden.jar;${lib.dir}/woden-ant.jar;${downloads.lib.dir}/${XmlSchemaFile};${downloads.lib.dir}/${XercesJar1};${downloads.lib.dir}/${XercesJar2}" />
@@ -33,37 +33,57 @@
<target name="main" description="---> Validate test suite, generates interchange format, and validates results" depends="documents-good, documents-bad, schemavalidate-results" />
<target name="documents-good" description="---> Validates W3C WSDL 2.0 good document test suite and outputs component model">
- <mkdir dir="results" />
- <validatewsdl20 dir="${test-suite.dir}/documents/good" includes="**/*.wsdl" cm="yes" cmdir="results" report="documents-good-report.xml" />
- <zip destfile="test-suite-results.zip" basedir="results" />
- </target>
-
- <target name="documents-bad" description="---> Validates W3C WSDL 2.0 bad document test suite and outputs report">
- <validatewsdl20 dir="${test-suite.dir}/documents/bad" includes="**/*.wsdl" cm="no" report="documents-bad-report.xml" />
- </target>
-
- <target name="schemavalidate-results" description="---> Validates component model interchange format results againt schema.">
- <schemavalidate failonerror="no">
- <schema namespace="http://www.w3.org/XML/1998/namespace" file="${xsd.dir}/xml.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component" file="${xsd.dir}/wsdlcm.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-base" file="${xsd.dir}/wsdlcm-base.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-extensions" file="${xsd.dir}/wsdlcm-extensions.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-http" file="${xsd.dir}/wsdlcm-http.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-rpc" file="${xsd.dir}/wsdlcm-rpc.xsd" />
- <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-soap" file="${xsd.dir}/wsdlcm-soap.xsd" />
- <fileset dir="results">
- <include name="**/*.wsdlcm" />
- </fileset>
- </schemavalidate>
- </target>
-
- <target name="schemavalidate-validation-reports">
- <schemavalidate failonerror="no">
- <schema namespace="http://www.w3.org/2006/06/wsdl/ValidationReport" file="${xmlcatalog.dir}/wsdl/ValidationReport.xsd" />
- <fileset dir=".">
- <include name="*-report.xml" />
- </fileset>
- </schemavalidate>
- </target>
+ <mkdir dir="results" />
+ <validatewsdl20 dir="${test-suite.dir}/documents/good" includes="**/*.wsdl" cm="yes" cmdir="results" report="documents-good-report.xml" />
+ <zip destfile="test-suite-results.zip" basedir="results" />
+ </target>
- </project>
\ No newline at end of file
+ <target name="documents-bad" description="---> Validates W3C WSDL 2.0 bad document test suite and outputs report">
+ <validatewsdl20 dir="${test-suite.dir}/documents/bad" includes="**/*.wsdl" cm="no" report="documents-bad-report.xml" />
+ </target>
+
+ <target name="schemavalidate-results" description="---> Validates component model interchange format results againt schema.">
+ <schemavalidate failonerror="no">
+ <schema namespace="http://www.w3.org/XML/1998/namespace" file="${xsd.dir}/xml.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component" file="${xsd.dir}/wsdlcm.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-base" file="${xsd.dir}/wsdlcm-base.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-extensions" file="${xsd.dir}/wsdlcm-extensions.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-http" file="${xsd.dir}/wsdlcm-http.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-rpc" file="${xsd.dir}/wsdlcm-rpc.xsd" />
+ <schema namespace="http://www.w3.org/2002/ws/desc/wsdl/component-soap" file="${xsd.dir}/wsdlcm-soap.xsd" />
+ <fileset dir="results">
+ <include name="**/*.wsdlcm" />
+ </fileset>
+ </schemavalidate>
+ </target>
+
+ <target name="schemavalidate-validation-reports">
+ <schemavalidate failonerror="no">
+ <schema namespace="http://www.w3.org/2006/06/wsdl/ValidationReport" file="${xmlcatalog.dir}/wsdl/ValidationReport.xsd" />
+ <fileset dir=".">
+ <include name="*-report.xml" />
+ </fileset>
+ </schemavalidate>
+ </target>
+
+
+ <!-- =================================
+ target: canonicalize-results
+ ================================= -->
+ <target name="canonicalize-results" description="--> Canonicalizes component interchange format results">
+ <xslt style="${test-suite.dir}/results/canonicalize-wsdlcm.xslt" includes="**/*.wsdlcm" extension=".wsdlcm1" destdir="."/>
+ <xslt style="${test-suite.dir}/results/canonicalize-id-wsdlcm.xslt" includes="**/*.wsdlcm1" extension=".wsdlcm2" destdir="."/>
+ </target>
+
+ <target name="compare">
+ <xslt style="${test-suite.dir}/results/compare-wsdlcm.xslt" in="results/Chameleon-1G/getBalance.wsdlcm2"
+ out="results/Chameleon-1G/getBalance-results.xml">
+ <param name="aspirant" expression="results/Chameleon-1G/getBalance.wsdlcm2"/>
+ <param name="archetype" expression="results-old/Chameleon-1G/getBalance.wsdlcm2"/>
+ </xslt>
+
+ </target>
+
+
+
+</project>
\ No newline at end of file
Modified: incubator/woden/java/ant-test/documents-good-report.xml
URL: http://svn.apache.org/viewvc/incubator/woden/java/ant-test/documents-good-report.xml?rev=419116&r1=419115&r2=419116&view=diff
==============================================================================
--- incubator/woden/java/ant-test/documents-good-report.xml (original)
+++ incubator/woden/java/ant-test/documents-good-report.xml Tue Jul 4 16:01:36 2006
@@ -19,6 +19,12 @@
<uri>file:///D:/workspaces/WSD2/desc/test-suite/documents/good/CreditCardFaults-1G/use-credit-card-faults.wsdl</uri>
</wsdl>
<wsdl>
+ <uri>file:///D:/workspaces/WSD2/desc/test-suite/documents/good/Echo-1G/echo.wsdl</uri>
+ </wsdl>
+ <wsdl>
+ <uri>file:///D:/workspaces/WSD2/desc/test-suite/documents/good/Feature-1G/bank.wsdl</uri>
+ </wsdl>
+ <wsdl>
<uri>file:///D:/workspaces/WSD2/desc/test-suite/documents/good/GreatH-1G/primer-hotelReservationService.wsdl</uri>
</wsdl>
<wsdl>
@@ -38,7 +44,7 @@
<columnNumber>0</columnNumber>
</errorLocator>
<key>Endpoint-0066</key>
- <message>The binding 'org.apache.woden.internal.wsdl20.BindingImpl@7e8a7ed1' specified for this endpoint specifies the interface 'org.apache.woden.internal.wsdl20.InterfaceImpl@7e09fed1' and not the interface 'org.apache.woden.internal.wsdl20.InterfaceImpl@67a9fed1' specified by the service. The binding specified for this endpoint must either not specify an interface or specify the same interface as the service.</message>
+ <message>The binding 'org.apache.woden.internal.wsdl20.BindingImpl@6da2f23c' specified for this endpoint specifies the interface 'org.apache.woden.internal.wsdl20.InterfaceImpl@6c3eb23c' and not the interface 'org.apache.woden.internal.wsdl20.InterfaceImpl@69ed723c' specified by the service. The binding specified for this endpoint must either not specify an interface or specify the same interface as the service.</message>
</error>
</wsdl>
<wsdl>
Modified: incubator/woden/java/ant-test/test-suite-results.zip
URL: http://svn.apache.org/viewvc/incubator/woden/java/ant-test/test-suite-results.zip?rev=419116&r1=419115&r2=419116&view=diff
==============================================================================
Binary files - no diff available.
Added: incubator/woden/java/src/org/apache/woden/ant/CmBaseWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmBaseWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmBaseWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmBaseWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,212 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.wsdl20.Feature;
+import org.apache.woden.wsdl20.Property;
+
+public class CmBaseWriter extends NamespaceWriter {
+
+ public final static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component-base";
+
+ public final static String PREFIX = "cmbase";
+
+ // element names
+ public final static String FEATURES = PREFIX + ":features";
+ public final static String FEATURE_COMPONENT = PREFIX + ":featureComponent";
+ public final static String LOCAL_NAME = PREFIX + ":localName";
+ public final static String NAMESPACE_NAME = PREFIX + ":namespaceName";
+ public final static String PARENT = PREFIX + ":parent";
+ public final static String PROPERTIES = PREFIX + ":properties";
+ public final static String PROPERTY_COMPONENT = PREFIX + ":propertyComponent";
+ public final static String REF = PREFIX + ":ref";
+ public final static String REQUIRED = PREFIX + ":required";
+ public final static String URI = PREFIX + ":uri";
+ public final static String VALUE = PREFIX + ":value";
+ public final static String VALUE_CONSTRAINT = PREFIX + ":valueConstraint";
+
+ public CmBaseWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+ }
+
+ public void features(Feature[] features) {
+
+ write(FEATURES, features);
+ }
+
+ public void properties(Property[] properties) {
+
+ write(PROPERTIES, properties);
+ }
+
+ public void parent(Object parent) {
+
+ writeRef(PARENT, parent);
+ }
+
+ public void write(String tag, QName qname) {
+
+ if (qname == null)
+ return;
+
+ out.beginElement(tag);
+
+ out.element(NAMESPACE_NAME, qname.getNamespaceURI());
+ out.element(LOCAL_NAME, qname.getLocalPart());
+
+ out.endElement();
+ }
+
+ public void writeUris(String tag, URI[] uris) {
+
+ if (uris.length == 0)
+ return;
+
+ Arrays.sort(uris);
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < uris.length; i++)
+ write(URI, uris[i]);
+
+ out.endElement();
+ }
+
+ public void writeOptionalRef(String tag, Object o) {
+
+ if (o == null)
+ return;
+
+ writeRef(tag, o);
+ }
+
+ public void writeRef(String tag, Object o) {
+
+ out.emptyElement(tag, refAttribute(o));
+ }
+
+ public static String id(Object o) {
+
+ if (o == null) {
+ return "id-null";
+ }
+
+ return "id-" + o.hashCode();
+ }
+
+ public static String idAttribute(Object o) {
+
+ return "xml:id='" + id(o) + "'";
+ }
+
+ public static String refAttribute(Object o) {
+
+ return "ref='" + id(o) + "'";
+ }
+
+ public void write(String tag, Feature[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ URI x1 = ((Feature) o1).getRef();
+ URI x2 = ((Feature) o2).getRef();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++) {
+ write(FEATURE_COMPONENT, components[i]);
+ }
+ out.endElement();
+ }
+
+ public void write(String tag, Feature component) {
+
+ out.beginElement(tag, idAttribute(component));
+
+ write(REF, component.getRef());
+ out.write(REQUIRED, component.isRequired());
+ writeRef(PARENT, component.getParent());
+
+ out.endElement();
+ }
+
+ public void write(String tag, Property[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ URI x1 = ((Property) o1).getRef();
+ URI x2 = ((Property) o2).getRef();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++) {
+ write(PROPERTY_COMPONENT, components[i]);
+ }
+
+ out.endElement();
+ }
+
+ public void write(String tag, Property component) {
+
+ out.beginElement(tag, idAttribute(component));
+
+ write(REF, component.getRef());
+ writeOptionalRef(VALUE_CONSTRAINT, component.getValueConstraint());
+ writeAny(VALUE, component.getValue());
+ writeRef(PARENT, component.getParent());
+
+ out.endElement();
+ }
+
+ public static int compareQName(QName q1, QName q2) {
+
+ if (q1.equals(q2))
+ return 0;
+
+ String n1 = q1.getNamespaceURI();
+ String n2 = q2.getNamespaceURI();
+ if (n1.equals(n2)) {
+ String l1 = q1.getLocalPart();
+ String l2 = q2.getLocalPart();
+
+ return l1.compareTo(l2);
+ } else {
+ return n1.compareTo(n2);
+ }
+ }
+}
Added: incubator/woden/java/src/org/apache/woden/ant/CmExtensionsWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmExtensionsWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmExtensionsWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmExtensionsWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import org.apache.woden.wsdl20.extensions.InterfaceOperationExtensions;
+
+/**
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class CmExtensionsWriter extends NamespaceWriter {
+
+ public final static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component-extensions";
+
+ public final static String PREFIX = "cmextensions";
+
+ public static final String WSDL_INTERFACE_OPERATION_EXTENSION = PREFIX
+ + ":wsdlInterfaceOperationExtension";
+
+ public static final String SAFETY = PREFIX + ":safety";
+
+ public CmExtensionsWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+ }
+
+ public void wsdlInterfaceOperationExtension(
+ InterfaceOperationExtensions extensions) {
+
+ if (extensions == null)
+ return;
+
+ out.beginElement(WSDL_INTERFACE_OPERATION_EXTENSION);
+
+ out.write(SAFETY, extensions.isSafety());
+
+ out.endElement();
+ }
+}
Added: incubator/woden/java/src/org/apache/woden/ant/CmHttpWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmHttpWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmHttpWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmHttpWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,202 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import org.apache.woden.wsdl20.extensions.http.HTTPAuthenticationScheme;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPErrorStatusCode;
+import org.apache.woden.wsdl20.extensions.http.HTTPHeader;
+
+/**
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class CmHttpWriter extends NamespaceWriter {
+
+ public final static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component-http";
+
+ public final static String PREFIX = "cmhttp";
+
+ private CmBaseWriter cmbase;
+
+ public CmHttpWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+
+ cmbase = (CmBaseWriter) out.lookup(CmBaseWriter.NS);
+ }
+
+ public void httpBindingExtension(HTTPBindingExtensions http) {
+
+ if (http == null)
+ return;
+
+ out.beginElement(PREFIX + ":httpBindingExtension");
+
+ out.write(PREFIX + ":httpCookies", http.isHttpCookies());
+ out.write(PREFIX + ":httpMethodDefault", http.getHttpMethodDefault());
+ out.write(PREFIX + ":httpQueryParameterSeparatorDefault", http
+ .getHttpQueryParameterSeparatorDefault());
+ out.write(PREFIX + ":httpTransferCodingDefault", http
+ .getHttpTransferCodingDefault());
+
+ out.endElement();
+ }
+
+ public void httpBindingFaultExtension(HTTPBindingFaultExtensions http) {
+
+ if (http != null) {
+
+ out.beginElement(PREFIX + ":httpBindingFaultExtension");
+
+ write(PREFIX + ":httpErrorStatusCode", http
+ .getHttpErrorStatusCode());
+ write(PREFIX + ":httpHeaders", http.getHttpHeaders());
+ out.write(PREFIX + ":httpTransferCoding", http
+ .getHttpTransferCoding());
+
+ out.endElement();
+ }
+ }
+
+ public void httpBindingOperationExtension(
+ HTTPBindingOperationExtensions http) {
+
+ if (http == null)
+ return;
+ out.beginElement(PREFIX + ":httpBindingOperationExtension");
+
+ out.write(PREFIX + ":httpFaultSerialization", http
+ .getHttpFaultSerialization());
+ out.write(PREFIX + ":httpInputSerialization", http
+ .getHttpInputSerialization());
+ cmbase.write(PREFIX + ":httpLocation", http.getHttpLocation());
+ out.write(PREFIX + ":httpLocationIgnoreUncited", http
+ .isHttpLocationIgnoreUncited());
+ out.write(PREFIX + ":httpMethod", http.getHttpMethod());
+ out.write(PREFIX + ":httpOutputSerialization", http
+ .getHttpOutputSerialization());
+ out.write(PREFIX + ":httpQueryParameterSeparator", http
+ .getHttpQueryParameterSeparator());
+ out.write(PREFIX + ":httpTransferCodingDefault", http
+ .getHttpTransferCodingDefault());
+
+ out.endElement();
+
+ }
+
+ public void httpBindingMessageReferenceExtension(
+ HTTPBindingMessageReferenceExtensions http) {
+
+ if (http == null)
+ return;
+
+ out.beginElement(PREFIX + ":httpBindingMessageReferenceExtension");
+
+ write(PREFIX + ":httpHeaders", http.getHttpHeaders());
+ out.write(PREFIX + ":httpTransferCoding", http.getHttpTransferCoding());
+
+ out.endElement();
+
+ }
+
+ public void httpEndpointExtension(HTTPEndpointExtensions http) {
+
+ if (http == null)
+ return;
+
+ out.beginElement(PREFIX + ":httpEndpointExtension");
+
+ out.write(PREFIX + ":httpAuthenticationRealm", http
+ .getHttpAuthenticationRealm());
+ write(PREFIX + ":httpAuthenticationScheme", http
+ .getHttpAuthenicationScheme());
+
+ out.endElement();
+ }
+
+ private void write(String tag, HTTPErrorStatusCode httpErrorStatusCode) {
+
+ if (httpErrorStatusCode == null)
+ return;
+
+ out.beginElement(tag);
+
+ if (httpErrorStatusCode.isCodeUsed()) {
+
+ out.write(PREFIX + ":code", httpErrorStatusCode.toString());
+ }
+
+ out.endElement();
+ }
+
+ private void write(String tag, HTTPHeader[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ String n1 = ((HTTPHeader) o1).getName();
+ String n2 = ((HTTPHeader) o2).getName();
+
+ return n1.compareTo(n2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write(PREFIX + ":HttpHeaderComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, HTTPHeader component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ out.write(PREFIX + ":name", component.getName());
+
+ cmbase.writeRef(PREFIX + ":typeDefinition", component
+ .getTypeDefinition());
+
+ out.write(PREFIX + ":required", component.isRequired());
+
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+ }
+
+ private void write(String tag, HTTPAuthenticationScheme scheme) {
+
+ if (scheme == null)
+ return;
+
+ out.write(tag, scheme.toString());
+ }
+
+}
Added: incubator/woden/java/src/org/apache/woden/ant/CmRpcWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmRpcWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmRpcWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmRpcWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,85 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import org.apache.woden.wsdl20.extensions.rpc.Argument;
+import org.apache.woden.wsdl20.extensions.rpc.Direction;
+import org.apache.woden.wsdl20.extensions.rpc.RPCInterfaceOperationExtensions;
+
+/**
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class CmRpcWriter extends NamespaceWriter {
+
+ public final static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component-rpc";
+
+ public final static String PREFIX = "cmrpc";
+
+ public static final String RPC_INTERFACE_OPERATION_EXTENSION = PREFIX
+ + ":rpcInterfaceOperationExtension";
+
+ public static final String RPC_SIGNATURE = PREFIX + ":rpcSignature";
+
+ /**
+ * @param out
+ */
+ public CmRpcWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+ }
+
+ public void rpcInterfaceOperationExtension(
+ RPCInterfaceOperationExtensions rpcExtensions) {
+
+ if (rpcExtensions == null)
+ return;
+
+ out.beginElement(RPC_INTERFACE_OPERATION_EXTENSION);
+
+ write(RPC_SIGNATURE, rpcExtensions.getRPCSignature());
+
+ out.endElement();
+ }
+
+ private void write(String tag, Argument[] rpcSignature) {
+
+ out.beginElement(tag);
+ for (int i = 0; i < rpcSignature.length; i++) {
+
+ write(PREFIX + ":argument", rpcSignature[i]);
+ }
+ out.endElement();
+ }
+
+ private void write(String tag, Argument argument) {
+
+ CmBaseWriter cmbase = (CmBaseWriter) out.lookup(CmBaseWriter.NS);
+
+ out.beginElement(tag);
+
+ cmbase.write(PREFIX + ":name", argument.getName());
+ write(PREFIX + ":direction", argument.getDirection());
+
+ out.endElement();
+ }
+
+ private void write(String tag, Direction direction) {
+
+ out.element(tag, direction.toString());
+ }
+}
Added: incubator/woden/java/src/org/apache/woden/ant/CmSoapWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmSoapWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmSoapWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmSoapWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,246 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Comparator;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPFaultCode;
+import org.apache.woden.wsdl20.extensions.soap.SOAPFaultSubcodes;
+import org.apache.woden.wsdl20.extensions.soap.SOAPHeaderBlock;
+import org.apache.woden.wsdl20.extensions.soap.SOAPModule;
+
+/**
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class CmSoapWriter extends NamespaceWriter {
+
+ public final static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component-soap";
+
+ public final static String PREFIX = "cmsoap";
+
+ private CmBaseWriter cmbase;
+
+ private CmHttpWriter cmhttp;
+
+ /**
+ * @param out
+ */
+ public CmSoapWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+
+ cmbase = (CmBaseWriter) out.lookup(CmBaseWriter.NS);
+ cmhttp = (CmHttpWriter) out.lookup(CmHttpWriter.NS);
+ }
+
+ public void soapBindingExtension(SOAPBindingExtensions soap) {
+
+ if (soap == null)
+ return;
+
+ out.beginElement(PREFIX + ":soapBindingExtension");
+
+ write(PREFIX + ":soapMepDefault", soap.getSoapMepDefault());
+ write(PREFIX + ":soapModules", soap.getSoapModules());
+ write(PREFIX + ":soapUnderlyingProtocols", soap.getSoapMepDefault());
+ out.write(PREFIX + ":soapVersion", soap.getSoapVersion());
+
+ out.endElement();
+ }
+
+ public void soapBindingFaultExtension(SOAPBindingFaultExtensions soap) {
+
+ if (soap == null)
+ return;
+
+ out.beginElement(PREFIX + ":soapBindingFaultExtension");
+
+ write(PREFIX + ":soapFaultCode", soap.getSoapFaultCode());
+ write(PREFIX + ":soapFaultSubcodes", soap.getSoapFaultSubcodes());
+ write(PREFIX + ":soapHeaders", soap.getSoapHeaders());
+ write(PREFIX + ":soapModules", soap.getSoapModules());
+
+ out.endElement();
+ }
+
+ public void soapBindingOperationExtension(
+ SOAPBindingOperationExtensions soap) {
+
+ if (soap == null)
+ return;
+
+ out.beginElement(PREFIX + ":soapBindingOperationExtension");
+
+ write(PREFIX + ":soapAction", soap.getSoapAction());
+ write(PREFIX + ":soapMep", soap.getSoapMep());
+ write(PREFIX + ":soapModules", soap.getSoapModules());
+
+ out.endElement();
+ }
+
+ public void soapBindingMessageReferenceExtension(
+ SOAPBindingMessageReferenceExtensions soap) {
+
+ if (soap == null)
+ return;
+
+ out.beginElement(PREFIX + ":soapBindingMessageReferenceExtension");
+
+ write(PREFIX + ":soapHeaders", soap.getSoapHeaders());
+ write(PREFIX + ":soapModules", soap.getSoapModules());
+
+ out.endElement();
+ }
+
+ public void soapBindingFaultReferenceExtension(
+ SOAPBindingFaultReferenceExtensions soap) {
+
+ if (soap == null)
+ return;
+
+ out.beginElement(PREFIX + ":soapBindingFaultReferenceExtension");
+
+ write(PREFIX + ":soapModules", soap.getSoapModules());
+
+ out.endElement();
+ }
+
+ private void write(String tag, SOAPModule[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ URI uri1 = ((SOAPModule) o1).getRef();
+ URI uri2 = ((SOAPModule) o2).getRef();
+
+ return uri1.compareTo(uri2);
+ }
+ });
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("SoapModuleComponent", components[i]);
+
+ out.endElement();
+
+ }
+
+ private void write(String tag, SOAPModule component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write(PREFIX + ":ref", component.getRef());
+
+ out.write(PREFIX + ":required", component.isRequired().booleanValue());
+
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+ }
+
+ private void write(String tag, SOAPFaultSubcodes soapFaultSubcodes) {
+
+ out.beginElement(tag);
+ if (soapFaultSubcodes.isQNames()) {
+ out.beginElement(PREFIX + ":subcodes");
+ QName[] codes = soapFaultSubcodes.getQNames();
+ for (int i = 0; i < codes.length; i++) {
+ cmbase.write(PREFIX + ":code", codes[i]);
+ }
+ out.endElement();
+ }
+ out.endElement();
+ }
+
+ private void write(String tag, SOAPFaultCode soapFaultCode) {
+
+ out.beginElement(tag);
+ if (soapFaultCode.isQName()) {
+ cmbase.write(PREFIX + ":code", soapFaultCode.getQName());
+ }
+ out.endElement();
+ }
+
+ private void write(String tag, SOAPHeaderBlock[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ ElementDeclaration ed1 = ((SOAPHeaderBlock) o1)
+ .getElementDeclaration();
+ ElementDeclaration ed2 = ((SOAPHeaderBlock) o2)
+ .getElementDeclaration();
+
+ if (ed1 == ed2)
+ return 0;
+ if (ed1 == null)
+ return -1;
+ if (ed2 == null)
+ return 1;
+
+ QName x1 = ed1.getName();
+ QName x2 = ed2.getName();
+
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write(PREFIX + ":SoapHeaderBlockComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, SOAPHeaderBlock component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.writeRef(PREFIX + ":elementDeclaration", component
+ .getElementDeclaration());
+
+ out.write(PREFIX + ":mustUnderstand", component.mustUnderstand()
+ .booleanValue());
+
+ out.write(PREFIX + ":required", component.isRequired().booleanValue());
+
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+
+ }
+}
Added: incubator/woden/java/src/org/apache/woden/ant/CmWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/CmWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/CmWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/CmWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,797 @@
+/**
+ * Copyright 2006 Apache Software Foundation
+ *
+ * Licensed 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.ant;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import org.apache.woden.wsdl20.Binding;
+import org.apache.woden.wsdl20.BindingFault;
+import org.apache.woden.wsdl20.BindingFaultReference;
+import org.apache.woden.wsdl20.BindingMessageReference;
+import org.apache.woden.wsdl20.BindingOperation;
+import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.woden.wsdl20.Endpoint;
+import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
+import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Service;
+import org.apache.woden.wsdl20.TypeDefinition;
+import org.apache.woden.wsdl20.extensions.ComponentExtensions;
+import org.apache.woden.wsdl20.extensions.InterfaceOperationExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingFaultExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingMessageReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPBindingOperationExtensions;
+import org.apache.woden.wsdl20.extensions.http.HTTPEndpointExtensions;
+import org.apache.woden.wsdl20.extensions.rpc.RPCInterfaceOperationExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingFaultReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingMessageReferenceExtensions;
+import org.apache.woden.wsdl20.extensions.soap.SOAPBindingOperationExtensions;
+
+/**
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public class CmWriter extends NamespaceWriter {
+
+ public static String NS = "http://www.w3.org/2002/ws/desc/wsdl/component";
+
+ public static String PREFIX = "";
+
+ /** XML Schema namespace */
+ private static String XSD_NS = "http://www.w3.org/2001/XMLSchema";
+
+ /** build-in simple types */
+ private static String[] XSD_TYPES = { "string", "boolean", "decimal",
+ "float", "double", "duration", "dateTime", "time", "date",
+ "gYearMonth", "gYear", "gMonthDay", "gDay", "gMonth", "hexBinary",
+ "base64Binary", "anyURI", "QName", "NOTATION", "normalizedString",
+ "token", "language", "NMTOKEN", "NMTOKENS", "Name", "NCName", "ID",
+ "IDREF", "IDREFS", "ENTITY", "ENTITIES", "integer",
+ "nonPositiveInteger", "negativeInteger", "long", "int", "short",
+ "byte", "nonNegativeInteger", "unsignedLong", "unsignedInt",
+ "unsignedShort", "unsignedByte", "positiveInteger" };
+
+ {
+ Arrays.sort(XSD_TYPES);
+ }
+
+ private CmBaseWriter cmbase;
+
+ private CmExtensionsWriter cmextensions;
+
+ private CmRpcWriter cmrpc;
+
+ private CmHttpWriter cmhttp;
+
+ private CmSoapWriter cmsoap;
+
+ public CmWriter(XMLWriter out) {
+
+ super(out, NS, PREFIX);
+
+ cmbase = (CmBaseWriter) out.lookup(CmBaseWriter.NS);
+ cmextensions = (CmExtensionsWriter) out.lookup(CmExtensionsWriter.NS);
+ cmrpc = (CmRpcWriter) out.lookup(CmRpcWriter.NS);
+ cmhttp = (CmHttpWriter) out.lookup(CmHttpWriter.NS);
+ cmsoap = (CmSoapWriter) out.lookup(CmSoapWriter.NS);
+ }
+
+ /**
+ * Writes the component model.
+ *
+ * @param component the root Description component
+ */
+ public void write(Description component) {
+
+ out.xmlDeclaration("UTF-8");
+
+ String attributes = "xmlns='" + NS + "'\n";
+ attributes += " xmlns:" + CmExtensionsWriter.PREFIX + "='"
+ + CmExtensionsWriter.NS + "'\n";
+ attributes += " xmlns:" + CmBaseWriter.PREFIX + "='" + CmBaseWriter.NS
+ + "'\n";
+ attributes += " xmlns:" + CmHttpWriter.PREFIX + "='" + CmHttpWriter.NS
+ + "'\n";
+ attributes += " xmlns:" + CmRpcWriter.PREFIX + "='" + CmRpcWriter.NS
+ + "'\n";
+ attributes += " xmlns:" + CmSoapWriter.PREFIX + "='" + CmSoapWriter.NS
+ + "'\n";
+ attributes += CmBaseWriter.idAttribute(component);
+ out.beginElement("descriptionComponent", attributes);
+
+ URI[] extensions = { ComponentExtensions.URI_NS_EXTENSIONS,
+ ComponentExtensions.URI_NS_HTTP,
+ ComponentExtensions.URI_NS_RPC, ComponentExtensions.URI_NS_SOAP };
+
+ cmbase.writeUris("extensions", extensions);
+ write("interfaces", component.getInterfaces());
+ write("bindings", component.getBindings());
+ write("services", component.getServices());
+ write("elementDeclarations", component.getElementDeclarations());
+ write("typeDefinitions", component.getTypeDefinitions());
+
+ out.endElement();
+ }
+
+ private void writeRefs(String tag, Interface[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((Interface) o1).getName();
+ QName x2 = ((Interface) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++) {
+ cmbase.writeRef("interface", components[i]);
+ }
+
+ out.endElement();
+
+ }
+
+ private void write(String tag, Interface[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((Interface) o1).getName();
+ QName x2 = ((Interface) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("interfaceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, Interface component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ writeRefs("extendedInterfaces", component.getExtendedInterfaces());
+ write("interfaceFaults", component.getInterfaceFaults());
+ write("interfaceOperations", component.getInterfaceOperations());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceFault[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((InterfaceFault) o1).getName();
+ QName x2 = ((InterfaceFault) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("interfaceFaultComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceFault component) {
+
+ out.beginElement("interfaceFaultComponent", CmBaseWriter
+ .idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ cmbase.writeOptionalRef("elementDeclaration", component
+ .getElementDeclaration());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceOperation[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((InterfaceOperation) o1).getName();
+ QName x2 = ((InterfaceOperation) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("interfaceOperationComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceOperation component) {
+
+ out.beginElement("interfaceOperationComponent", CmBaseWriter
+ .idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ write("messageExchangePattern", component.getMessageExchangePattern());
+ write("interfaceMessageReferences", component
+ .getInterfaceMessageReferences());
+ write("interfaceFaultReferences", component
+ .getInterfaceFaultReferences());
+ cmbase.writeUris("style", component.getStyle());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ InterfaceOperationExtensions extensions = (InterfaceOperationExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_EXTENSIONS);
+ cmextensions.wsdlInterfaceOperationExtension(extensions);
+
+ RPCInterfaceOperationExtensions rpcExtensions = (RPCInterfaceOperationExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_RPC);
+ cmrpc.rpcInterfaceOperationExtension(rpcExtensions);
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceMessageReference[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ String x1 = ((InterfaceMessageReference) o1).getMessageLabel()
+ .toString();
+ String x2 = ((InterfaceMessageReference) o2).getMessageLabel()
+ .toString();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("interfaceMessageReferenceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceMessageReference component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ out.write("messageLabel", component.getMessageLabel().toString());
+ out.write("direction", component.getDirection().toString());
+ out.write("messageContentModel", component.getMessageContentModel());
+ cmbase.writeOptionalRef("elementDeclaration", component
+ .getElementDeclaration());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceFaultReference[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ InterfaceFaultReference i1 = (InterfaceFaultReference) o1;
+ InterfaceFaultReference i2 = (InterfaceFaultReference) o2;
+
+ InterfaceFault if1 = i1.getInterfaceFault();
+ InterfaceFault if2 = i2.getInterfaceFault();
+
+ if (if1 == if2)
+ return 0;
+ if (if1 == null)
+ return -1;
+ if (if2 == null)
+ return 1;
+
+ QName q1 = if1.getName();
+ QName q2 = if2.getName();
+
+ int result = CmBaseWriter.compareQName(q1, q2);
+ if (result != 0)
+ return result;
+
+ String x1 = i1.getMessageLabel().toString();
+ String x2 = i2.getMessageLabel().toString();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("interfaceFaultReferenceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, InterfaceFaultReference component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.writeRef("interfaceFault", component.getInterfaceFault());
+ out.write("messageLabel", component.getMessageLabel().toString());
+ out.write("direction", component.getDirection().toString());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ out.endElement();
+ }
+
+ private void write(String tag, Binding[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((Binding) o1).getName();
+ QName x2 = ((Binding) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("bindingComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, Binding component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ cmbase.writeOptionalRef("interface", component.getInterface());
+ write("type", component.getType());
+ write("bindingFaults", component.getBindingFaults());
+ write("bindingOperations", component.getBindingOperations());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+
+ HTTPBindingExtensions http = (HTTPBindingExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+ cmhttp.httpBindingExtension(http);
+
+ SOAPBindingExtensions soap = (SOAPBindingExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ cmsoap.soapBindingExtension(soap);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingFault[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ InterfaceFault if1 = ((BindingFault) o1).getInterfaceFault();
+ InterfaceFault if2 = ((BindingFault) o2).getInterfaceFault();
+
+ if (if1 == if2)
+ return 0;
+ if (if1 == null)
+ return -1;
+ if (if2 == null)
+ return 1;
+
+ QName x1 = if1.getName();
+ QName x2 = if2.getName();
+
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("bindingFaultComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingFault component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.writeRef("interfaceFault", component.getInterfaceFault());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ HTTPBindingFaultExtensions http = (HTTPBindingFaultExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+ cmhttp.httpBindingFaultExtension(http);
+
+ SOAPBindingFaultExtensions soap = (SOAPBindingFaultExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ cmsoap.soapBindingFaultExtension(soap);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingOperation[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((BindingOperation) o1).getInterfaceOperation()
+ .getName();
+ QName x2 = ((BindingOperation) o1).getInterfaceOperation()
+ .getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("bindingOperationComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingOperation component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase
+ .writeRef("interfaceOperation", component
+ .getInterfaceOperation());
+ write("bindingFaultReferences", component.getBindingFaultReferences());
+ write("bindingMessageReferences", component
+ .getBindingMessageReferences());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ HTTPBindingOperationExtensions http = (HTTPBindingOperationExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+ cmhttp.httpBindingOperationExtension(http);
+
+ SOAPBindingOperationExtensions soap = (SOAPBindingOperationExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ cmsoap.soapBindingOperationExtension(soap);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingMessageReference[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ InterfaceMessageReference i1 = ((BindingMessageReference) o1)
+ .getInterfaceMessageReference();
+ InterfaceMessageReference i2 = ((BindingMessageReference) o2)
+ .getInterfaceMessageReference();
+
+ String x1 = i1.getMessageLabel().toString();
+ String x2 = i2.getMessageLabel().toString();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("bindingMessageReferenceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingMessageReference component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.writeRef("interfaceMessageReference", component
+ .getInterfaceMessageReference());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ HTTPBindingMessageReferenceExtensions http = (HTTPBindingMessageReferenceExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+ cmhttp.httpBindingMessageReferenceExtension(http);
+
+ SOAPBindingMessageReferenceExtensions soap = (SOAPBindingMessageReferenceExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ cmsoap.soapBindingMessageReferenceExtension(soap);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingFaultReference[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+
+ InterfaceFaultReference i1 = ((BindingFaultReference) o1)
+ .getInterfaceFaultReference();
+ InterfaceFaultReference i2 = ((BindingFaultReference) o2)
+ .getInterfaceFaultReference();
+
+ QName q1 = i1.getInterfaceFault().getName();
+ QName q2 = i2.getInterfaceFault().getName();
+
+ int result = CmBaseWriter.compareQName(q1, q2);
+ if (result != 0)
+ return result;
+
+ String x1 = i1.getMessageLabel().toString();
+ String x2 = i2.getMessageLabel().toString();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("bindingFaultReferenceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, BindingFaultReference component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.writeRef("interfaceFaultReference", component
+ .getInterfaceFaultReference());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ SOAPBindingFaultReferenceExtensions soap = (SOAPBindingFaultReferenceExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
+ cmsoap.soapBindingFaultReferenceExtension(soap);
+
+ out.endElement();
+ }
+
+ private void write(String tag, Service[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((Service) o1).getName();
+ QName x2 = ((Service) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("serviceComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, Service component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ cmbase.writeRef("interface", component.getInterface());
+ write("endpoints", component.getEndpoints());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+
+ out.endElement();
+ }
+
+ private void write(String tag, Endpoint[] components) {
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ String x1 = ((Endpoint) o1).getName().toString();
+ String x2 = ((Endpoint) o2).getName().toString();
+ return x1.compareTo(x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++) {
+ write("endpointComponent", components[i]);
+ }
+
+ out.endElement();
+
+ }
+
+ private void write(String tag, Endpoint component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ out.write("name", component.getName());
+ cmbase.writeRef("binding", component.getBinding());
+ cmbase.write("address", component.getAddress());
+ cmbase.features(component.getFeatures());
+ cmbase.properties(component.getProperties());
+ cmbase.parent(component.getParent());
+
+ HTTPEndpointExtensions http = (HTTPEndpointExtensions) component
+ .getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP);
+ cmhttp.httpEndpointExtension(http);
+
+ out.endElement();
+ }
+
+ private void write(String tag, ElementDeclaration[] components) {
+
+ // filter out the XSD elements until Woden fixes the bug
+ Vector filteredElements = new Vector();
+ for (int i = 0; i < components.length; i++) {
+ if (!XSD_NS.equals(components[i].getName().getNamespaceURI()))
+ filteredElements.addElement(components[i]);
+ }
+ components = new ElementDeclaration[filteredElements.size()];
+ filteredElements.copyInto(components);
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((ElementDeclaration) o1).getName();
+ QName x2 = ((ElementDeclaration) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("elementDeclarationComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, ElementDeclaration component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ write("system", component.getSystem());
+
+ out.endElement();
+ }
+
+ private void write(String tag, TypeDefinition[] components) {
+
+ // filter out the XSD non-built-in types until Woden fixes the bug
+ Vector filteredTypes = new Vector();
+ for (int i = 0; i < components.length; i++) {
+ if (!XSD_NS.equals(components[i].getName().getNamespaceURI())) {
+ filteredTypes.addElement(components[i]);
+ } else {
+ if (Arrays.binarySearch(XSD_TYPES, components[i].getName()
+ .getLocalPart()) >= 0)
+ filteredTypes.addElement(components[i]);
+ }
+ }
+ components = new TypeDefinition[filteredTypes.size()];
+ filteredTypes.copyInto(components);
+
+ if (components.length == 0)
+ return;
+
+ Arrays.sort(components, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ QName x1 = ((TypeDefinition) o1).getName();
+ QName x2 = ((TypeDefinition) o2).getName();
+ return CmBaseWriter.compareQName(x1, x2);
+ }
+ });
+
+ out.beginElement(tag);
+
+ for (int i = 0; i < components.length; i++)
+ write("typeDefinitionComponent", components[i]);
+
+ out.endElement();
+ }
+
+ private void write(String tag, TypeDefinition component) {
+
+ out.beginElement(tag, CmBaseWriter.idAttribute(component));
+
+ cmbase.write("name", component.getName());
+ write("system", component.getSystem());
+
+ out.endElement();
+ }
+
+}
Added: incubator/woden/java/src/org/apache/woden/ant/NamespaceWriter.java
URL: http://svn.apache.org/viewvc/incubator/woden/java/src/org/apache/woden/ant/NamespaceWriter.java?rev=419116&view=auto
==============================================================================
--- incubator/woden/java/src/org/apache/woden/ant/NamespaceWriter.java (added)
+++ incubator/woden/java/src/org/apache/woden/ant/NamespaceWriter.java Tue Jul 4 16:01:36 2006
@@ -0,0 +1,54 @@
+package org.apache.woden.ant;
+
+import java.net.URI;
+
+/**
+ * This is the abstract base class for classes that write elements and types from an XML namespace;
+ *
+ * @author Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)
+ *
+ */
+public abstract class NamespaceWriter {
+
+ protected XMLWriter out;
+
+ private String namespace;
+
+ private String prefix;
+
+ public NamespaceWriter(XMLWriter out, String namespace, String prefix) {
+
+ this.out = out;
+ this.namespace = namespace;
+ this.prefix = prefix;
+
+ out.register(this);
+ }
+
+ public String getNamespace() {
+
+ return namespace;
+ }
+
+ public String getPrefix() {
+
+ return prefix;
+ }
+
+ public void write(String tag, URI uri) {
+
+ if (uri == null)
+ return;
+
+ out.element(tag, uri.toString());
+ }
+
+ public void writeAny(String tag, Object o) {
+
+ if (o == null)
+ return;
+
+ // TODO: write element content correctly
+ out.element(tag, o.toString());
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org