diff options
Diffstat (limited to '')
5 files changed, 71 insertions, 15 deletions
diff --git a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java index 457eceda8b..3dcbe0d6f2 100644 --- a/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java +++ b/java/sca/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/POJOWSTestCase.java @@ -34,14 +34,14 @@ public class POJOWSTestCase { Node node = NodeFactory.newInstance().createNode("org/apache/tuscany/sca/binding/ws/axis2/itests/pojo/test.composite", contrib); node.start(); - // try { - // System.out.println("Test server started (press enter to shutdown)"); - // System.in.read(); - // } - // catch (IOException e) { - // System.err.println(e); - // e.printStackTrace(); - // } +// try { +// System.out.println("Test server started (press enter to shutdown)"); +// System.in.read(); +// } +// catch (IOException e) { +// System.err.println(e); +// e.printStackTrace(); +// } node.stop(); System.out.println("Test server stopped"); diff --git a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java index 885a9390d8..12a2c6feb8 100644 --- a/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java +++ b/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java @@ -38,6 +38,7 @@ import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper; import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor; +import org.apache.tuscany.sca.interfacedef.java.jaxws.WebServiceInterfaceProcessor; import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint; import org.oasisopen.sca.CallableReference; @@ -80,12 +81,12 @@ public class DataBindingModuleActivator implements ModuleActivator { FactoryExtensionPoint modelFactories = registry.getExtensionPoint(FactoryExtensionPoint.class); JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - - // [rfeng] The JAX-WS processor should come before the Databinding processor to make sure @WebService - // is honored as Remoteable + // Add the WebServiceInterfaceProcessor to mark the interface remotable + javaFactory.addInterfaceVisitor(new WebServiceInterfaceProcessor()); + // Introspect the data types + javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings)); javaFactory.addInterfaceVisitor(new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, xmlAdapterExtensionPoint)); - javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings)); RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class); if (wireProcessorExtensionPoint != null) { diff --git a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java index 05184f6cd0..2f7b9dc76d 100644 --- a/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java +++ b/java/sca/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java @@ -396,7 +396,8 @@ public final class JAXBContextHelper { typeQName = new QName(typeNamespace, typeName); } else { XmlEnum xmlEnum = javaType.getAnnotation(XmlEnum.class); - if (xmlEnum != null) { + // POJO can have the @XmlSchema on the package-info too + if (xmlEnum != null || namespace != null) { name = jaxbDecapitalize(javaType.getSimpleName()); typeQName = new QName(namespace, name); } diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index 262b0405ec..d3c461ff73 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java @@ -53,6 +53,7 @@ import org.apache.tuscany.sca.interfacedef.java.JavaOperation; import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor; import org.apache.tuscany.sca.interfacedef.util.ElementInfo; import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; +import org.apache.tuscany.sca.interfacedef.util.TypeInfo; import org.apache.tuscany.sca.interfacedef.util.WrapperInfo; import org.apache.tuscany.sca.interfacedef.util.XMLType; @@ -271,10 +272,12 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { name = getValue(name, "arg" + i); QName element = new QName(ns, name); Object logical = operation.getInputType().getLogical().get(i).getLogical(); + QName type = null; if (logical instanceof XMLType) { ((XMLType)logical).setElementName(element); + type = ((XMLType)logical).getTypeName(); } - inputElements.add(new ElementInfo(element, null)); + inputElements.add(new ElementInfo(element, new TypeInfo(type, false, null))); } List<ElementInfo> outputElements = new ArrayList<ElementInfo>(); @@ -288,10 +291,12 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { if (operation.getOutputType() != null) { Object logical = operation.getOutputType().getLogical(); + QName type = null; if (logical instanceof XMLType) { ((XMLType)logical).setElementName(element); + type = ((XMLType)logical).getTypeName(); } - outputElements.add(new ElementInfo(element, null)); + outputElements.add(new ElementInfo(element, new TypeInfo(type, false, null))); } String db = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING; diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java new file mode 100644 index 0000000000..18eda13efb --- /dev/null +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java @@ -0,0 +1,49 @@ +/* + * 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.sca.interfacedef.java.jaxws; + +import javax.jws.WebService; + +import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; +import org.apache.tuscany.sca.interfacedef.java.JavaInterface; +import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor; + +/** + * Introspect the java class/interface to see if it has @WebService annotation + * + * @version $Rev$ $Date$ + */ +public class WebServiceInterfaceProcessor implements JavaInterfaceVisitor { + + public WebServiceInterfaceProcessor() { + super(); + } + + public void visitInterface(JavaInterface contract) throws InvalidInterfaceException { + + final Class<?> clazz = contract.getJavaClass(); + WebService webService = clazz.getAnnotation(WebService.class); + if (webService != null) { + // Mark SEI as Remotable + contract.setRemotable(true); + } + } + +} |