diff options
Diffstat (limited to 'java/sca/modules/interface-java-jaxws')
4 files changed, 20 insertions, 5 deletions
diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java index a23036db7c..b05715b54e 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java @@ -261,5 +261,20 @@ public class CodeGenerationHelper { return Opcodes.ARETURN; } + + /** + * Get the package prefix for generated JAXWS artifacts + * @param cls + * @return + */ + public static String getPackagePrefix(Class<?> cls) { + String name = cls.getName(); + int index = name.lastIndexOf('.'); + if (index == -1) { + return "jaxws."; + } else { + return name.substring(0, index) + ".jaxws."; + } + } } diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java index fa32060447..a4f2facb4b 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java @@ -293,7 +293,7 @@ public class JAXWSFaultExceptionMapper implements FaultExceptionMapper { } if (faultBean == null) { - final String faultBeanClassName = cls.getPackage().getName() + ".jaxws." + cls.getSimpleName() + "Bean"; + final String faultBeanClassName = CodeGenerationHelper.getPackagePrefix(cls) + cls.getSimpleName() + "Bean"; final QName qname = faultName; faultType = AccessController.doPrivileged(new PrivilegedAction<DataType<XMLType>>() { public DataType<XMLType> run() { 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 758dcb5dd7..1e1a0c4e94 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 @@ -188,7 +188,7 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { requestWrapper == null ? operationName : getValue(requestWrapper.localName(), operationName); String wrapperBeanName = requestWrapper == null ? "" : requestWrapper.className(); if ("".equals(wrapperBeanName)) { - wrapperBeanName = clazz.getPackage().getName() + ".jaxws." + capitalize(method.getName()); + wrapperBeanName = CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName()); } DataType<XMLType> inputWrapperDT = null; @@ -222,7 +222,7 @@ public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor { wrapperBeanName = responseWrapper == null ? "" : responseWrapper.className(); if ("".equals(wrapperBeanName)) { wrapperBeanName = - clazz.getPackage().getName() + ".jaxws." + capitalize(method.getName()) + "Response"; + CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName()) + "Response"; } DataType<XMLType> outputWrapperDT = null; diff --git a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java index 785496f7b6..764c10ff00 100644 --- a/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java +++ b/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java @@ -50,7 +50,7 @@ public class WrapperBeanGenerator extends BaseBeanGenerator { String wrapperNamespace = JavaInterfaceUtil.getNamespace(sei); String wrapperName = m.getName(); String wrapperBeanName = capitalize(wrapperName); - String wrapperClassName = sei.getPackage().getName() + ".jaxws." + wrapperBeanName; + String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName; return generateRequestWrapper(m, wrapperClassName, wrapperNamespace, wrapperName, cl); } @@ -111,7 +111,7 @@ public class WrapperBeanGenerator extends BaseBeanGenerator { String wrapperName = m.getName() + "Response"; String wrapperBeanName = capitalize(wrapperName); - String wrapperClassName = sei.getPackage().getName() + ".jaxws." + wrapperBeanName; + String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName; return generateResponseWrapper(m, wrapperClassName, wrapperNamespace, wrapperName, cl); } |