diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-18 04:43:15 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-18 04:43:15 +0000 |
commit | 175eef1031996bf177675620242a5a0ce865766c (patch) | |
tree | 1503665852bc8ca39a0a1c24c1c490d6597fb06e /branches/sca-java-1.x/modules | |
parent | 50a856b26b629cbbfb0b18c9f8f8c8418209d19c (diff) |
Fix the J2W generation issue which misses the target namespace
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@755474 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.x/modules')
4 files changed, 63 insertions, 7 deletions
diff --git a/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java index b4fc718914..66469a9db7 100644 --- a/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java +++ b/branches/sca-java-1.x/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java @@ -42,6 +42,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.osoa.sca.CallableReference; import org.apache.axiom.om.OMElement; @@ -86,12 +87,12 @@ public class DataBindingModuleActivator implements ModuleActivator { ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.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/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java index 5265184ba6..01989759b8 100644 --- a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java +++ b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java @@ -396,7 +396,8 @@ public 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/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java index d1b36fa17c..ac086745c0 100644 --- a/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java +++ b/branches/sca-java-1.x/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/branches/sca-java-1.x/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java b/branches/sca-java-1.x/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/branches/sca-java-1.x/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); + } + } + +} |