From e84e7c3249d63d21fb281f078fb8ff1fed8a5305 Mon Sep 17 00:00:00 2001 From: rfeng Date: Mon, 13 Jul 2009 05:50:20 +0000 Subject: Add DOM/AXIOM databindings git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@793463 13f79535-47bb-0310-9956-ffa450edef68 --- .../tools/wsdl2java/axiom/AXIOMDataBinding.java | 57 +++++++++++++++++++++ .../tools/wsdl2java/dom/DOMDataBinding.java | 58 ++++++++++++++++++++++ .../src/main/resources/META-INF/tools-plugin.xml | 2 + .../wsdl2java/dom/DOMDataBindingTestCase.java | 40 +++++++++++++++ 4 files changed, 157 insertions(+) create mode 100644 branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/axiom/AXIOMDataBinding.java create mode 100644 branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBinding.java create mode 100644 branches/sca-java-1.x/tools/databinding/sdo/src/test/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBindingTestCase.java (limited to 'branches/sca-java-1.x/tools/databinding') diff --git a/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/axiom/AXIOMDataBinding.java b/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/axiom/AXIOMDataBinding.java new file mode 100644 index 0000000000..d2a6523002 --- /dev/null +++ b/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/axiom/AXIOMDataBinding.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.tuscany.tools.wsdl2java.axiom; + +import javax.xml.namespace.QName; + +import org.apache.cxf.tools.common.ToolContext; +import org.apache.cxf.tools.common.ToolException; +import org.apache.cxf.tools.common.model.DefaultValueWriter; +import org.apache.cxf.tools.wsdlto.core.DataBindingProfile; + +/** + * + */ +public class AXIOMDataBinding implements DataBindingProfile { + private static final String OM_ELEMENT = "org.apache.axis2.om.OMElement"; + + public DefaultValueWriter createDefaultValueWriter(QName qn, boolean element) { + return null; + } + + public DefaultValueWriter createDefaultValueWriterForWrappedElement(QName wrapperElement, QName qn) { + return null; + } + + public void generate(ToolContext context) throws ToolException { + } + + public String getType(QName qn, boolean element) { + return OM_ELEMENT; + } + + public String getWrappedElementType(QName wrapperElement, QName item) { + return OM_ELEMENT; + } + + public void initialize(ToolContext c) throws ToolException { + } + +} diff --git a/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBinding.java b/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBinding.java new file mode 100644 index 0000000000..c668d59db5 --- /dev/null +++ b/branches/sca-java-1.x/tools/databinding/sdo/src/main/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBinding.java @@ -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.tuscany.tools.wsdl2java.dom; + +import javax.xml.namespace.QName; + +import org.apache.cxf.tools.common.ToolContext; +import org.apache.cxf.tools.common.ToolException; +import org.apache.cxf.tools.common.model.DefaultValueWriter; +import org.apache.cxf.tools.wsdlto.core.DataBindingProfile; + +/** + * + */ +public class DOMDataBinding implements DataBindingProfile { + + private static final String DOM_ELEMENT = "org.w3c.dom.Element"; + + public DefaultValueWriter createDefaultValueWriter(QName qn, boolean element) { + return null; + } + + public DefaultValueWriter createDefaultValueWriterForWrappedElement(QName wrapperElement, QName qn) { + return null; + } + + public void generate(ToolContext context) throws ToolException { + } + + public String getType(QName qn, boolean element) { + return DOM_ELEMENT; + } + + public String getWrappedElementType(QName wrapperElement, QName item) { + return DOM_ELEMENT; + } + + public void initialize(ToolContext c) throws ToolException { + } + +} diff --git a/branches/sca-java-1.x/tools/databinding/sdo/src/main/resources/META-INF/tools-plugin.xml b/branches/sca-java-1.x/tools/databinding/sdo/src/main/resources/META-INF/tools-plugin.xml index abcdeb0f7c..814c6c93b6 100644 --- a/branches/sca-java-1.x/tools/databinding/sdo/src/main/resources/META-INF/tools-plugin.xml +++ b/branches/sca-java-1.x/tools/databinding/sdo/src/main/resources/META-INF/tools-plugin.xml @@ -20,4 +20,6 @@ + + \ No newline at end of file diff --git a/branches/sca-java-1.x/tools/databinding/sdo/src/test/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBindingTestCase.java b/branches/sca-java-1.x/tools/databinding/sdo/src/test/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBindingTestCase.java new file mode 100644 index 0000000000..95c5a979dd --- /dev/null +++ b/branches/sca-java-1.x/tools/databinding/sdo/src/test/java/org/apache/tuscany/tools/wsdl2java/dom/DOMDataBindingTestCase.java @@ -0,0 +1,40 @@ +/* + * 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.tuscany.tools.wsdl2java.dom; + +import java.net.URL; + +import org.apache.cxf.tools.wsdlto.WSDLToJava; +import org.junit.Test; + +/** + * + */ +public class DOMDataBindingTestCase { + + @Test + public void testGenerateDynamic() { + URL url = getClass().getResource("/HelloService.wsdl"); + String args[] = new String[] {"-db", "dom", "-d", "target/jaxws-dom-source", url.toString()}; + WSDLToJava.main(args); + + } + +} -- cgit v1.2.3