You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/05/18 18:39:48 UTC
svn commit: r539517 [3/9] - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/ api/src/main/java/org/apache/cxf/binding/
api/src/main/java/org/apache/cxf/clustering/
api/src/main/java/org/apache/cxf/endpoint/
api/src/main/java/org/apache/cxf/fe...
Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java Fri May 18 09:39:38 2007
@@ -1,89 +1,89 @@
-/**
- * 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.cxf.tools.common.model;
-
-import junit.framework.TestCase;
-import org.junit.Test;
-
-public class JavaClassTest extends TestCase {
- @Test
- public void testGetterSetter() throws Exception {
- JavaField field = new JavaField("arg0",
- "org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
- "http://doc.withannotation.fortest.tools.cxf.apache.org/");
- JavaClass clz = new JavaClass();
- clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.EchoDataBean");
- JavaMethod getter = clz.appendGetter(field);
- assertEquals("getArg0", getter.getName());
- assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
- getter.getReturn().getClassName());
- assertEquals("arg0", getter.getReturn().getName());
-
- JavaMethod setter = clz.appendSetter(field);
- assertEquals("setArg0", setter.getName());
- assertEquals("void", setter.getReturn().getClassName());
- assertEquals("arg0", getter.getReturn().getName());
- assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
- setter.getParameters().get(0).getClassName());
- }
-
- @Test
- public void testGetterSetterStringArray() {
- JavaField field = new JavaField("array",
- "String[]",
- "http://doc.withannotation.fortest.tools.cxf.apache.org/");
-
- JavaClass clz = new JavaClass();
- clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHi");
- JavaMethod getter = clz.appendGetter(field);
- assertEquals("getArray", getter.getName());
- assertEquals("String[]",
- getter.getReturn().getClassName());
- assertEquals("array", getter.getReturn().getName());
- assertEquals("return this.array;", getter.getJavaCodeBlock().getExpressions().get(0).toString());
-
- JavaMethod setter = clz.appendSetter(field);
- assertEquals("setArray", setter.getName());
- assertEquals("void", setter.getReturn().getClassName());
- assertEquals("array", getter.getReturn().getName());
- assertEquals("String[]",
- setter.getParameters().get(0).getClassName());
- assertEquals("this.array = newArray;", setter.getJavaCodeBlock().getExpressions().get(0).toString());
-
-
- field = new JavaField("return",
- "String[]",
- "http://doc.withannotation.fortest.tools.cxf.apache.org/");
- clz = new JavaClass();
- clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHiResponse");
- getter = clz.appendGetter(field);
- assertEquals("get_return", getter.getName());
- assertEquals("String[]",
- getter.getReturn().getClassName());
- assertEquals("_return", getter.getReturn().getName());
-
- setter = clz.appendSetter(field);
- assertEquals("set_return", setter.getName());
- assertEquals("void", setter.getReturn().getClassName());
- assertEquals("_return", getter.getReturn().getName());
- assertEquals("String[]",
- setter.getParameters().get(0).getClassName());
- }
-}
+/**
+ * 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.cxf.tools.common.model;
+
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class JavaClassTest extends TestCase {
+ @Test
+ public void testGetterSetter() throws Exception {
+ JavaField field = new JavaField("arg0",
+ "org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
+ "http://doc.withannotation.fortest.tools.cxf.apache.org/");
+ JavaClass clz = new JavaClass();
+ clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.EchoDataBean");
+ JavaMethod getter = clz.appendGetter(field);
+ assertEquals("getArg0", getter.getName());
+ assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
+ getter.getReturn().getClassName());
+ assertEquals("arg0", getter.getReturn().getName());
+
+ JavaMethod setter = clz.appendSetter(field);
+ assertEquals("setArg0", setter.getName());
+ assertEquals("void", setter.getReturn().getClassName());
+ assertEquals("arg0", getter.getReturn().getName());
+ assertEquals("org.apache.cxf.tools.fortest.withannotation.doc.TestDataBean",
+ setter.getParameters().get(0).getClassName());
+ }
+
+ @Test
+ public void testGetterSetterStringArray() {
+ JavaField field = new JavaField("array",
+ "String[]",
+ "http://doc.withannotation.fortest.tools.cxf.apache.org/");
+
+ JavaClass clz = new JavaClass();
+ clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHi");
+ JavaMethod getter = clz.appendGetter(field);
+ assertEquals("getArray", getter.getName());
+ assertEquals("String[]",
+ getter.getReturn().getClassName());
+ assertEquals("array", getter.getReturn().getName());
+ assertEquals("return this.array;", getter.getJavaCodeBlock().getExpressions().get(0).toString());
+
+ JavaMethod setter = clz.appendSetter(field);
+ assertEquals("setArray", setter.getName());
+ assertEquals("void", setter.getReturn().getClassName());
+ assertEquals("array", getter.getReturn().getName());
+ assertEquals("String[]",
+ setter.getParameters().get(0).getClassName());
+ assertEquals("this.array = newArray;", setter.getJavaCodeBlock().getExpressions().get(0).toString());
+
+
+ field = new JavaField("return",
+ "String[]",
+ "http://doc.withannotation.fortest.tools.cxf.apache.org/");
+ clz = new JavaClass();
+ clz.setFullClassName("org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHiResponse");
+ getter = clz.appendGetter(field);
+ assertEquals("get_return", getter.getName());
+ assertEquals("String[]",
+ getter.getReturn().getClassName());
+ assertEquals("_return", getter.getReturn().getName());
+
+ setter = clz.appendSetter(field);
+ assertEquals("set_return", setter.getName());
+ assertEquals("void", setter.getReturn().getClassName());
+ assertEquals("_return", getter.getReturn().getName());
+ assertEquals("String[]",
+ setter.getParameters().get(0).getClassName());
+ }
+}
Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaClassTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java (original)
+++ incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java Fri May 18 09:39:38 2007
@@ -1,34 +1,34 @@
-/**
- * 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.cxf.tools.common.model;
-
-import junit.framework.TestCase;
-import org.junit.Test;
-
-public class JavaInterfaceTest extends TestCase {
- @Test
- public void testSetFullClassName() throws Exception {
- String fullName = "org.apache.cxf.tools.common.model.JavaInterface";
- JavaInterface intf = new JavaInterface();
- intf.setFullClassName(fullName);
- assertEquals("org.apache.cxf.tools.common.model", intf.getPackageName());
- assertEquals("JavaInterface", intf.getName());
- }
-}
+/**
+ * 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.cxf.tools.common.model;
+
+import junit.framework.TestCase;
+import org.junit.Test;
+
+public class JavaInterfaceTest extends TestCase {
+ @Test
+ public void testSetFullClassName() throws Exception {
+ String fullName = "org.apache.cxf.tools.common.model.JavaInterface";
+ JavaInterface intf = new JavaInterface();
+ intf.setFullClassName(fullName);
+ assertEquals("org.apache.cxf.tools.common.model", intf.getPackageName());
+ assertEquals("JavaInterface", intf.getName());
+ }
+}
Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/common/src/test/java/org/apache/cxf/tools/common/model/JavaInterfaceTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java Fri May 18 09:39:38 2007
@@ -1,102 +1,102 @@
-/**
- * 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.cxf.tools.java2wsdl.generator.wsdl11;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.VelocityGenerator;
-import org.apache.cxf.tools.common.model.JavaClass;
-import org.apache.cxf.tools.java2wsdl.generator.AbstractGenerator;
-import org.apache.cxf.tools.util.Compiler;
-import org.apache.cxf.tools.util.FileWriterUtil;
-
-public class BeanGenerator extends AbstractGenerator<File> {
- private static final String TEMPLATE = "org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm";
- private File compileToDir;
-
- public void setCompileToDir(File f) {
- compileToDir = f;
- }
-
- protected Collection<JavaClass> generateBeanClasses(final ServiceInfo service) {
- return null;
- }
-
- public File generate(final File sourcedir) {
- File dir = getOutputBase();
- if (dir == null) {
- dir = sourcedir;
- }
- if (dir == null) {
- dir = new File("./");
- }
- Collection<JavaClass> wrapperClasses = generateBeanClasses(getServiceModel());
-
- if (!wrapperClasses.isEmpty()) {
- generateAndCompile(wrapperClasses, dir);
- }
-
- return dir;
- }
-
- public void generateAndCompile(Collection<JavaClass> wrapperClasses, File dir) {
- VelocityGenerator generator = new VelocityGenerator();
- generator.setBaseDir(dir.toString());
-
- List<File> generatedFiles = new ArrayList<File>();
- try {
- for (JavaClass wrapperClass : wrapperClasses) {
- generator.setCommonAttributes();
- generator.setAttributes("bean", wrapperClass);
-
- File file = generator.parseOutputName(wrapperClass.getPackageName(),
- wrapperClass.getName());
- generatedFiles.add(file);
-
- generator.doWrite(TEMPLATE, FileWriterUtil.getWriter(file));
-
- generator.clearAttributes();
- }
-
-
- if (compileToDir != null) {
- //compile the classes
- Compiler compiler = new Compiler();
-
- List<String> files = new ArrayList<String>(generatedFiles.size());
- for (File file : generatedFiles) {
- files.add(file.getAbsolutePath());
- }
- if (!compiler.compileFiles(files.toArray(new String[files.size()]),
- compileToDir)) {
- //TODO - compile issue
- }
-
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.VelocityGenerator;
+import org.apache.cxf.tools.common.model.JavaClass;
+import org.apache.cxf.tools.java2wsdl.generator.AbstractGenerator;
+import org.apache.cxf.tools.util.Compiler;
+import org.apache.cxf.tools.util.FileWriterUtil;
+
+public class BeanGenerator extends AbstractGenerator<File> {
+ private static final String TEMPLATE = "org/apache/cxf/tools/java2wsdl/generator/wsdl11/wrapperbean.vm";
+ private File compileToDir;
+
+ public void setCompileToDir(File f) {
+ compileToDir = f;
+ }
+
+ protected Collection<JavaClass> generateBeanClasses(final ServiceInfo service) {
+ return null;
+ }
+
+ public File generate(final File sourcedir) {
+ File dir = getOutputBase();
+ if (dir == null) {
+ dir = sourcedir;
+ }
+ if (dir == null) {
+ dir = new File("./");
+ }
+ Collection<JavaClass> wrapperClasses = generateBeanClasses(getServiceModel());
+
+ if (!wrapperClasses.isEmpty()) {
+ generateAndCompile(wrapperClasses, dir);
+ }
+
+ return dir;
+ }
+
+ public void generateAndCompile(Collection<JavaClass> wrapperClasses, File dir) {
+ VelocityGenerator generator = new VelocityGenerator();
+ generator.setBaseDir(dir.toString());
+
+ List<File> generatedFiles = new ArrayList<File>();
+ try {
+ for (JavaClass wrapperClass : wrapperClasses) {
+ generator.setCommonAttributes();
+ generator.setAttributes("bean", wrapperClass);
+
+ File file = generator.parseOutputName(wrapperClass.getPackageName(),
+ wrapperClass.getName());
+ generatedFiles.add(file);
+
+ generator.doWrite(TEMPLATE, FileWriterUtil.getWriter(file));
+
+ generator.clearAttributes();
+ }
+
+
+ if (compileToDir != null) {
+ //compile the classes
+ Compiler compiler = new Compiler();
+
+ List<String> files = new ArrayList<String>(generatedFiles.size());
+ for (File file : generatedFiles) {
+ files.add(file.getAbsolutePath());
+ }
+ if (!compiler.compileFiles(files.toArray(new String[files.size()]),
+ compileToDir)) {
+ //TODO - compile issue
+ }
+
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/BeanGenerator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java Fri May 18 09:39:38 2007
@@ -1,91 +1,91 @@
-/**
- * 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.cxf.tools.java2wsdl.generator.wsdl11;
-
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.rmi.ServerException;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import javax.wsdl.Fault;
-
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.model.JavaClass;
-import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.FaultBean;
-
-
-public final class FaultBeanGenerator extends BeanGenerator {
-
- private String getSEIPackage(final Method method) {
- return method.getDeclaringClass().getPackage().getName();
- }
-
- protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
- Set<Class> exceptionClasses = new HashSet<Class>();
- String seiPackageName = null;
- for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
- Method method = (Method) op.getProperty("operation.method");
- exceptionClasses.addAll(getExceptionClasses(method));
- seiPackageName = getSEIPackage(method);
- }
-
- Collection<JavaClass> faultBeanClasses = new HashSet<JavaClass>();
- String defaultPackage = seiPackageName + ".jaxws";
- FaultBean bean = new FaultBean();
- for (Class clz : exceptionClasses) {
- faultBeanClasses.add(bean.transform(clz, defaultPackage));
- }
-
- return faultBeanClasses;
- }
-
- protected Set<Class> getExceptionClasses(final Method method) {
- Set<Class> exps = new HashSet<Class>();
- final Class[] exceptionClasses = method.getExceptionTypes();
- for (int i = 0; i < exceptionClasses.length; i++) {
- boolean exclude = false;
- Class exClazz = exceptionClasses[i];
-
- if (exClazz.equals(Exception.class)
- || Fault.class.isAssignableFrom(exClazz)
- || exClazz.equals(RuntimeException.class)
- || exClazz.equals(Throwable.class)
- || exClazz.equals(RemoteException.class)
- || exClazz.equals(ServerException.class)) {
- continue;
- }
-
- Method[] expMethods = exClazz.getMethods();
- for (Method expMethod : expMethods) {
- if ("getFaultInfo".equals(expMethod.getName())) {
- exclude = true;
- break;
- }
- }
- if (exclude) {
- continue;
- }
- exps.add(exClazz);
- }
- return exps;
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11;
+
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.rmi.ServerException;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import javax.wsdl.Fault;
+
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.model.JavaClass;
+import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.FaultBean;
+
+
+public final class FaultBeanGenerator extends BeanGenerator {
+
+ private String getSEIPackage(final Method method) {
+ return method.getDeclaringClass().getPackage().getName();
+ }
+
+ protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
+ Set<Class> exceptionClasses = new HashSet<Class>();
+ String seiPackageName = null;
+ for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
+ Method method = (Method) op.getProperty("operation.method");
+ exceptionClasses.addAll(getExceptionClasses(method));
+ seiPackageName = getSEIPackage(method);
+ }
+
+ Collection<JavaClass> faultBeanClasses = new HashSet<JavaClass>();
+ String defaultPackage = seiPackageName + ".jaxws";
+ FaultBean bean = new FaultBean();
+ for (Class clz : exceptionClasses) {
+ faultBeanClasses.add(bean.transform(clz, defaultPackage));
+ }
+
+ return faultBeanClasses;
+ }
+
+ protected Set<Class> getExceptionClasses(final Method method) {
+ Set<Class> exps = new HashSet<Class>();
+ final Class[] exceptionClasses = method.getExceptionTypes();
+ for (int i = 0; i < exceptionClasses.length; i++) {
+ boolean exclude = false;
+ Class exClazz = exceptionClasses[i];
+
+ if (exClazz.equals(Exception.class)
+ || Fault.class.isAssignableFrom(exClazz)
+ || exClazz.equals(RuntimeException.class)
+ || exClazz.equals(Throwable.class)
+ || exClazz.equals(RemoteException.class)
+ || exClazz.equals(ServerException.class)) {
+ continue;
+ }
+
+ Method[] expMethods = exClazz.getMethods();
+ for (Method expMethod : expMethods) {
+ if ("getFaultInfo".equals(expMethod.getName())) {
+ exclude = true;
+ break;
+ }
+ }
+ if (exclude) {
+ continue;
+ }
+ exps.add(exClazz);
+ }
+ return exps;
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/FaultBeanGenerator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java Fri May 18 09:39:38 2007
@@ -1,60 +1,60 @@
-/**
- * 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.cxf.tools.java2wsdl.generator.wsdl11;
-
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.cxf.tools.common.model.JavaClass;
-import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.RequestWrapper;
-import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.ResponseWrapper;
-
-public final class WrapperBeanGenerator extends BeanGenerator {
- protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
- Collection<JavaClass> wrapperClasses = new HashSet<JavaClass>();
-
- for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
- if (op.getUnwrappedOperation() != null) {
- if (op.hasInput()) {
- RequestWrapper requestWrapper = new RequestWrapper();
- requestWrapper.setOperationInfo(op);
- JavaClass jClass = requestWrapper.buildWrapperBeanClass();
-
- if (requestWrapper.isWrapperBeanClassNotExist()) {
- wrapperClasses.add(jClass);
- }
- }
- if (op.hasOutput()) {
- ResponseWrapper responseWrapper = new ResponseWrapper();
- responseWrapper.setOperationInfo(op);
- JavaClass jClass = responseWrapper.buildWrapperBeanClass();
-
- if (responseWrapper.isWrapperBeanClassNotExist()) {
- wrapperClasses.add(jClass);
- }
- }
- }
- }
- return wrapperClasses;
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11;
+
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.tools.common.model.JavaClass;
+import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.RequestWrapper;
+import org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.ResponseWrapper;
+
+public final class WrapperBeanGenerator extends BeanGenerator {
+ protected Collection<JavaClass> generateBeanClasses(final ServiceInfo serviceInfo) {
+ Collection<JavaClass> wrapperClasses = new HashSet<JavaClass>();
+
+ for (OperationInfo op : serviceInfo.getInterface().getOperations()) {
+ if (op.getUnwrappedOperation() != null) {
+ if (op.hasInput()) {
+ RequestWrapper requestWrapper = new RequestWrapper();
+ requestWrapper.setOperationInfo(op);
+ JavaClass jClass = requestWrapper.buildWrapperBeanClass();
+
+ if (requestWrapper.isWrapperBeanClassNotExist()) {
+ wrapperClasses.add(jClass);
+ }
+ }
+ if (op.hasOutput()) {
+ ResponseWrapper responseWrapper = new ResponseWrapper();
+ responseWrapper.setOperationInfo(op);
+ JavaClass jClass = responseWrapper.buildWrapperBeanClass();
+
+ if (responseWrapper.isWrapperBeanClassNotExist()) {
+ wrapperClasses.add(jClass);
+ }
+ }
+ }
+ }
+ return wrapperClasses;
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/WrapperBeanGenerator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java Fri May 18 09:39:38 2007
@@ -1,58 +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.cxf.tools.java2wsdl.generator.wsdl11.annotator;
-
-import org.apache.cxf.tools.common.model.Annotator;
-import org.apache.cxf.tools.common.model.JavaAnnotatable;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
-import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
-
-public class WrapperBeanAnnotator implements Annotator {
-
- public void annotate(final JavaAnnotatable clz) {
- WrapperBeanClass wrapperBeanClass = null;
- if (clz instanceof WrapperBeanClass) {
- wrapperBeanClass = (WrapperBeanClass) clz;
- } else {
- throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input");
- }
-
- JavaAnnotation xmlRootElement = new JavaAnnotation("XmlRootElement");
- xmlRootElement.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
- xmlRootElement.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
-
- JavaAnnotation xmlAccessorType = new JavaAnnotation("XmlAccessorType");
- xmlAccessorType.addArgument("XmlAccessType.FIELD", "null", "");
-
- JavaAnnotation xmlType = new JavaAnnotation("XmlType");
- xmlType.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
- xmlType.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
-
- // Revisit: why annotation is string?
- wrapperBeanClass.addAnnotation(xmlRootElement.toString());
- wrapperBeanClass.addAnnotation(xmlAccessorType.toString());
- wrapperBeanClass.addAnnotation(xmlType.toString());
-
- wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessType");
- wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessorType");
- wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlRootElement");
- wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlType");
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11.annotator;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotatable;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
+
+public class WrapperBeanAnnotator implements Annotator {
+
+ public void annotate(final JavaAnnotatable clz) {
+ WrapperBeanClass wrapperBeanClass = null;
+ if (clz instanceof WrapperBeanClass) {
+ wrapperBeanClass = (WrapperBeanClass) clz;
+ } else {
+ throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input");
+ }
+
+ JavaAnnotation xmlRootElement = new JavaAnnotation("XmlRootElement");
+ xmlRootElement.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
+ xmlRootElement.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
+
+ JavaAnnotation xmlAccessorType = new JavaAnnotation("XmlAccessorType");
+ xmlAccessorType.addArgument("XmlAccessType.FIELD", "null", "");
+
+ JavaAnnotation xmlType = new JavaAnnotation("XmlType");
+ xmlType.addArgument("name", wrapperBeanClass.getElementName().getLocalPart());
+ xmlType.addArgument("namespace", wrapperBeanClass.getElementName().getNamespaceURI());
+
+ // Revisit: why annotation is string?
+ wrapperBeanClass.addAnnotation(xmlRootElement.toString());
+ wrapperBeanClass.addAnnotation(xmlAccessorType.toString());
+ wrapperBeanClass.addAnnotation(xmlType.toString());
+
+ wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessType");
+ wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlAccessorType");
+ wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlRootElement");
+ wrapperBeanClass.addImport("javax.xml.bind.annotation.XmlType");
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanAnnotator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java Fri May 18 09:39:38 2007
@@ -1,45 +1,45 @@
-/**
- * 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.cxf.tools.java2wsdl.generator.wsdl11.annotator;
-
-import org.apache.cxf.tools.common.model.Annotator;
-import org.apache.cxf.tools.common.model.JavaAnnotatable;
-import org.apache.cxf.tools.common.model.JavaAnnotation;
-import org.apache.cxf.tools.common.model.JavaField;
-
-public class WrapperBeanFieldAnnotator implements Annotator {
-
- public void annotate(final JavaAnnotatable field) {
- JavaField jField = null;
- if (field instanceof JavaField) {
- jField = (JavaField) field;
- } else {
- throw new RuntimeException("WrapperBeanFiledAnnotator expect JavaField as input");
- }
- String rawName = jField.getRawName();
- JavaAnnotation xmlElementAnnotation = new JavaAnnotation("XmlElement");
-
- xmlElementAnnotation.addArgument("name", rawName);
- xmlElementAnnotation.addArgument("namespace", jField.getTargetNamespace());
-
- jField.setAnnotation(xmlElementAnnotation);
- jField.getOwner().addImport("javax.xml.bind.annotation.XmlElement");
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11.annotator;
+
+import org.apache.cxf.tools.common.model.Annotator;
+import org.apache.cxf.tools.common.model.JavaAnnotatable;
+import org.apache.cxf.tools.common.model.JavaAnnotation;
+import org.apache.cxf.tools.common.model.JavaField;
+
+public class WrapperBeanFieldAnnotator implements Annotator {
+
+ public void annotate(final JavaAnnotatable field) {
+ JavaField jField = null;
+ if (field instanceof JavaField) {
+ jField = (JavaField) field;
+ } else {
+ throw new RuntimeException("WrapperBeanFiledAnnotator expect JavaField as input");
+ }
+ String rawName = jField.getRawName();
+ JavaAnnotation xmlElementAnnotation = new JavaAnnotation("XmlElement");
+
+ xmlElementAnnotation.addArgument("name", rawName);
+ xmlElementAnnotation.addArgument("namespace", jField.getTargetNamespace());
+
+ jField.setAnnotation(xmlElementAnnotation);
+ jField.getOwner().addImport("javax.xml.bind.annotation.XmlElement");
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/annotator/WrapperBeanFieldAnnotator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java Fri May 18 09:39:38 2007
@@ -1,50 +1,50 @@
-/**
- * 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.cxf.tools.java2wsdl.generator.wsdl11.model;
-
-import javax.xml.namespace.QName;
-
-import org.apache.cxf.tools.common.model.JavaClass;
-
-public class WrapperBeanClass extends JavaClass {
-
- /**
- * Describe elementName here.
- */
- private QName elementName;
-
- /**
- * Get the <code>ElementName</code> value.
- *
- * @return a <code>QName</code> value
- */
- public final QName getElementName() {
- return elementName;
- }
-
- /**
- * Set the <code>ElementName</code> value.
- *
- * @param newElementName The new ElementName value.
- */
- public final void setElementName(final QName newElementName) {
- this.elementName = newElementName;
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.generator.wsdl11.model;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.tools.common.model.JavaClass;
+
+public class WrapperBeanClass extends JavaClass {
+
+ /**
+ * Describe elementName here.
+ */
+ private QName elementName;
+
+ /**
+ * Get the <code>ElementName</code> value.
+ *
+ * @return a <code>QName</code> value
+ */
+ public final QName getElementName() {
+ return elementName;
+ }
+
+ /**
+ * Set the <code>ElementName</code> value.
+ *
+ * @param newElementName The new ElementName value.
+ */
+ public final void setElementName(final QName newElementName) {
+ this.elementName = newElementName;
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/wsdl11/model/WrapperBeanClass.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java Fri May 18 09:39:38 2007
@@ -1,97 +1,97 @@
-/**
- * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebFault;
-
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.tools.common.model.JavaClass;
-import org.apache.cxf.tools.common.model.JavaField;
-import org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator.WrapperBeanAnnotator;
-import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
-import org.apache.cxf.tools.util.URIParserUtil;
-
-public final class FaultBean {
- private static final String[] EXCLUDED_GETTER = new String[] {"getCause",
- "getLocalizedMessage",
- "getStackTrace",
- "getClass"};
-
-
- private String getWebFaultBean(final Class<?> exceptionClass) {
- WebFault fault = exceptionClass.getAnnotation(WebFault.class);
- if (fault == null) {
- return null;
- }
- return fault.faultBean();
- }
-
- private boolean isWebFaultAbsent(final Class exceptionClass) {
- return StringUtils.isEmpty(getWebFaultBean(exceptionClass));
- }
-
- public WrapperBeanClass transform(final Class exceptionClass, final String defaultPackage) {
- WrapperBeanClass jClass = new WrapperBeanClass();
- if (isWebFaultAbsent(exceptionClass)) {
- jClass.setName(exceptionClass.getSimpleName() + "Bean");
- jClass.setPackageName(defaultPackage);
- } else {
- jClass.setFullClassName(getWebFaultBean(exceptionClass));
- }
-
- buildBeanFields(exceptionClass, jClass);
-
- jClass.setElementName(new QName(URIParserUtil.getNamespace(exceptionClass.getPackage().getName()),
- exceptionClass.getSimpleName()));
- jClass.annotate(new WrapperBeanAnnotator());
-
- return jClass;
- }
-
- private String getFieldName(final Method method) {
- String name = method.getName().substring(3);
- char chars[] = name.toCharArray();
- chars[0] = Character.toLowerCase(chars[0]);
- return new String(chars);
- }
-
- private boolean isIncludedGetter(final Method method) {
- return method.getName().startsWith("get")
- && !Arrays.asList(EXCLUDED_GETTER).contains(method.getName());
- }
-
- private void buildBeanFields(final Class exceptionClass, final JavaClass jClass) {
- for (Method method : exceptionClass.getMethods()) {
- if (isIncludedGetter(method)) {
- JavaField field = new JavaField(getFieldName(method),
- method.getReturnType().getName(),
- "");
- field.setOwner(jClass);
- jClass.addField(field);
- jClass.appendGetter(field);
- jClass.appendSetter(field);
- }
- }
- }
-
-}
+/**
+ * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebFault;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.tools.common.model.JavaClass;
+import org.apache.cxf.tools.common.model.JavaField;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.annotator.WrapperBeanAnnotator;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
+import org.apache.cxf.tools.util.URIParserUtil;
+
+public final class FaultBean {
+ private static final String[] EXCLUDED_GETTER = new String[] {"getCause",
+ "getLocalizedMessage",
+ "getStackTrace",
+ "getClass"};
+
+
+ private String getWebFaultBean(final Class<?> exceptionClass) {
+ WebFault fault = exceptionClass.getAnnotation(WebFault.class);
+ if (fault == null) {
+ return null;
+ }
+ return fault.faultBean();
+ }
+
+ private boolean isWebFaultAbsent(final Class exceptionClass) {
+ return StringUtils.isEmpty(getWebFaultBean(exceptionClass));
+ }
+
+ public WrapperBeanClass transform(final Class exceptionClass, final String defaultPackage) {
+ WrapperBeanClass jClass = new WrapperBeanClass();
+ if (isWebFaultAbsent(exceptionClass)) {
+ jClass.setName(exceptionClass.getSimpleName() + "Bean");
+ jClass.setPackageName(defaultPackage);
+ } else {
+ jClass.setFullClassName(getWebFaultBean(exceptionClass));
+ }
+
+ buildBeanFields(exceptionClass, jClass);
+
+ jClass.setElementName(new QName(URIParserUtil.getNamespace(exceptionClass.getPackage().getName()),
+ exceptionClass.getSimpleName()));
+ jClass.annotate(new WrapperBeanAnnotator());
+
+ return jClass;
+ }
+
+ private String getFieldName(final Method method) {
+ String name = method.getName().substring(3);
+ char chars[] = name.toCharArray();
+ chars[0] = Character.toLowerCase(chars[0]);
+ return new String(chars);
+ }
+
+ private boolean isIncludedGetter(final Method method) {
+ return method.getName().startsWith("get")
+ && !Arrays.asList(EXCLUDED_GETTER).contains(method.getName());
+ }
+
+ private void buildBeanFields(final Class exceptionClass, final JavaClass jClass) {
+ for (Method method : exceptionClass.getMethods()) {
+ if (isIncludedGetter(method)) {
+ JavaField field = new JavaField(getFieldName(method),
+ method.getReturnType().getName(),
+ "");
+ field.setOwner(jClass);
+ jClass.addField(field);
+ jClass.appendGetter(field);
+ jClass.appendSetter(field);
+ }
+ }
+ }
+
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/FaultBean.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java Fri May 18 09:39:38 2007
@@ -1,99 +1,99 @@
-/**
- * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.tools.common.model.JavaField;
-import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
-import org.apache.cxf.tools.util.AnnotationUtil;
-
-public class RequestWrapper extends Wrapper {
- @Override
- public void setOperationInfo(final OperationInfo op) {
- super.setOperationInfo(op);
- setName(op.getInput().getMessageParts().get(0).getElementQName());
- setClassName((String)op.getInput().getMessageParts().get(0).getProperty("REQUEST.WRAPPER.CLASSNAME"));
- }
-
- @Override
- public boolean isWrapperAbsent(final Method method) {
- javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
- return getClassName() == null && (reqWrapper == null || StringUtils.isEmpty(reqWrapper.className()));
- }
-
- @Override
- protected List<JavaField> buildFields() {
- return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getInput());
- }
-
- protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
- List<JavaField> fields = new ArrayList<JavaField>();
- String name;
- String type;
-
- final Class[] paramClasses = method.getParameterTypes();
- for (MessagePartInfo mpi : message.getMessageParts()) {
- int idx = mpi.getIndex();
- name = mpi.getName().getLocalPart();
- Class clz = paramClasses[idx];
- if (clz.isArray()) {
- if (isBuiltInTypes(clz.getComponentType())) {
- type = clz.getComponentType().getSimpleName() + "[]";
- } else {
- type = clz.getComponentType().getName() + "[]";
- }
- } else {
- type = clz.getName();
- }
- JavaField field = new JavaField(name, type, "");
- fields.add(field);
-
- }
-
- return fields;
- }
-
- @Override
- public WrapperBeanClass getWrapperBeanClass(final Method method) {
- javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
- String reqClassName = getClassName();
- String reqNs = null;
-
- if (reqWrapper != null) {
- reqClassName = reqWrapper.className().length() > 0 ? reqWrapper.className() : reqClassName;
- reqNs = reqWrapper.targetNamespace().length() > 0 ? reqWrapper.targetNamespace() : null;
- }
- if (reqClassName == null) {
- reqClassName = getPackageName(method) + ".jaxws." + AnnotationUtil.capitalize(method.getName());
- }
-
- WrapperBeanClass jClass = new WrapperBeanClass();
- jClass.setFullClassName(reqClassName);
- jClass.setNamespace(reqNs);
- return jClass;
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.common.model.JavaField;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
+import org.apache.cxf.tools.util.AnnotationUtil;
+
+public class RequestWrapper extends Wrapper {
+ @Override
+ public void setOperationInfo(final OperationInfo op) {
+ super.setOperationInfo(op);
+ setName(op.getInput().getMessageParts().get(0).getElementQName());
+ setClassName((String)op.getInput().getMessageParts().get(0).getProperty("REQUEST.WRAPPER.CLASSNAME"));
+ }
+
+ @Override
+ public boolean isWrapperAbsent(final Method method) {
+ javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
+ return getClassName() == null && (reqWrapper == null || StringUtils.isEmpty(reqWrapper.className()));
+ }
+
+ @Override
+ protected List<JavaField> buildFields() {
+ return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getInput());
+ }
+
+ protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
+ List<JavaField> fields = new ArrayList<JavaField>();
+ String name;
+ String type;
+
+ final Class[] paramClasses = method.getParameterTypes();
+ for (MessagePartInfo mpi : message.getMessageParts()) {
+ int idx = mpi.getIndex();
+ name = mpi.getName().getLocalPart();
+ Class clz = paramClasses[idx];
+ if (clz.isArray()) {
+ if (isBuiltInTypes(clz.getComponentType())) {
+ type = clz.getComponentType().getSimpleName() + "[]";
+ } else {
+ type = clz.getComponentType().getName() + "[]";
+ }
+ } else {
+ type = clz.getName();
+ }
+ JavaField field = new JavaField(name, type, "");
+ fields.add(field);
+
+ }
+
+ return fields;
+ }
+
+ @Override
+ public WrapperBeanClass getWrapperBeanClass(final Method method) {
+ javax.xml.ws.RequestWrapper reqWrapper = method.getAnnotation(javax.xml.ws.RequestWrapper.class);
+ String reqClassName = getClassName();
+ String reqNs = null;
+
+ if (reqWrapper != null) {
+ reqClassName = reqWrapper.className().length() > 0 ? reqWrapper.className() : reqClassName;
+ reqNs = reqWrapper.targetNamespace().length() > 0 ? reqWrapper.targetNamespace() : null;
+ }
+ if (reqClassName == null) {
+ reqClassName = getPackageName(method) + ".jaxws." + AnnotationUtil.capitalize(method.getName());
+ }
+
+ WrapperBeanClass jClass = new WrapperBeanClass();
+ jClass.setFullClassName(reqClassName);
+ jClass.setNamespace(reqNs);
+ return jClass;
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/RequestWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java (original)
+++ incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java Fri May 18 09:39:38 2007
@@ -1,126 +1,126 @@
-/**
- * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.cxf.common.util.CollectionUtils;
-import org.apache.cxf.common.util.StringUtils;
-import org.apache.cxf.service.model.MessageInfo;
-import org.apache.cxf.service.model.MessagePartInfo;
-import org.apache.cxf.service.model.OperationInfo;
-import org.apache.cxf.tools.common.model.JavaField;
-import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
-import org.apache.cxf.tools.util.AnnotationUtil;
-
-
-public final class ResponseWrapper extends Wrapper {
- @Override
- public void setOperationInfo(final OperationInfo op) {
- super.setOperationInfo(op);
- setName(op.getOutput().getMessageParts().get(0).getElementQName());
- setClassName((String)op.getOutput().getMessageParts().get(0)
- .getProperty("RESPONSE.WRAPPER.CLASSNAME"));
- }
-
- @Override
- public boolean isWrapperAbsent(final Method method) {
- javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
- return getClassName() == null && (resWrapper == null || StringUtils.isEmpty(resWrapper.className()));
- }
-
- @Override
- protected List<JavaField> buildFields() {
- return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getOutput());
- }
-
- protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
- List<JavaField> fields = new ArrayList<JavaField>();
-
- final Class<?> returnType = method.getReturnType();
- JavaField field = new JavaField();
- if (CollectionUtils.isEmpty(message.getMessageParts())) {
- return fields;
- }
- MessagePartInfo part = message.getMessageParts().get(0);
- field.setName(part.getName().getLocalPart());
-
- if (!returnType.isAssignableFrom(void.class)) {
- String type;
- if (returnType.isArray()) {
- if (isBuiltInTypes(returnType.getComponentType())) {
- type = returnType.getComponentType().getSimpleName() + "[]";
- } else {
- type = returnType.getComponentType().getName() + "[]";
- }
- } else {
- type = returnType.getName();
- }
- field.setType(type);
- }
- fields.add(field);
-
- final Class[] paramClasses = method.getParameterTypes();
- for (MessagePartInfo mpi : message.getMessageParts()) {
- int idx = mpi.getIndex();
- if (idx >= 0) {
- String name = mpi.getName().getLocalPart();
- String type;
- Class clz = paramClasses[idx];
- if (clz.isArray()) {
- if (isBuiltInTypes(clz.getComponentType())) {
- type = clz.getComponentType().getSimpleName() + "[]";
- } else {
- type = clz.getComponentType().getName() + "[]";
- }
- } else {
- type = clz.getName();
- }
- fields.add(new JavaField(name, type, ""));
- }
- }
-
- return fields;
- }
-
- @Override
- public WrapperBeanClass getWrapperBeanClass(final Method method) {
- javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
- String resClassName = getClassName();
- String resNs = null;
-
- if (resWrapper != null) {
- resClassName = resWrapper.className().length() > 0 ? resWrapper.className() : resClassName;
- resNs = resWrapper.targetNamespace().length() > 0 ? resWrapper.targetNamespace() : null;
- }
- if (resClassName == null) {
- resClassName = getPackageName(method) + ".jaxws."
- + AnnotationUtil.capitalize(method.getName())
- + "Response";
- }
-
- WrapperBeanClass jClass = new WrapperBeanClass();
- jClass.setFullClassName(resClassName);
- jClass.setNamespace(resNs);
- return jClass;
- }
-}
+/**
+ * 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.cxf.tools.java2wsdl.processor.internal.jaxws;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.common.util.CollectionUtils;
+import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.service.model.MessageInfo;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.common.model.JavaField;
+import org.apache.cxf.tools.java2wsdl.generator.wsdl11.model.WrapperBeanClass;
+import org.apache.cxf.tools.util.AnnotationUtil;
+
+
+public final class ResponseWrapper extends Wrapper {
+ @Override
+ public void setOperationInfo(final OperationInfo op) {
+ super.setOperationInfo(op);
+ setName(op.getOutput().getMessageParts().get(0).getElementQName());
+ setClassName((String)op.getOutput().getMessageParts().get(0)
+ .getProperty("RESPONSE.WRAPPER.CLASSNAME"));
+ }
+
+ @Override
+ public boolean isWrapperAbsent(final Method method) {
+ javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
+ return getClassName() == null && (resWrapper == null || StringUtils.isEmpty(resWrapper.className()));
+ }
+
+ @Override
+ protected List<JavaField> buildFields() {
+ return buildFields(getMethod(), getOperationInfo().getUnwrappedOperation().getOutput());
+ }
+
+ protected List<JavaField> buildFields(final Method method, final MessageInfo message) {
+ List<JavaField> fields = new ArrayList<JavaField>();
+
+ final Class<?> returnType = method.getReturnType();
+ JavaField field = new JavaField();
+ if (CollectionUtils.isEmpty(message.getMessageParts())) {
+ return fields;
+ }
+ MessagePartInfo part = message.getMessageParts().get(0);
+ field.setName(part.getName().getLocalPart());
+
+ if (!returnType.isAssignableFrom(void.class)) {
+ String type;
+ if (returnType.isArray()) {
+ if (isBuiltInTypes(returnType.getComponentType())) {
+ type = returnType.getComponentType().getSimpleName() + "[]";
+ } else {
+ type = returnType.getComponentType().getName() + "[]";
+ }
+ } else {
+ type = returnType.getName();
+ }
+ field.setType(type);
+ }
+ fields.add(field);
+
+ final Class[] paramClasses = method.getParameterTypes();
+ for (MessagePartInfo mpi : message.getMessageParts()) {
+ int idx = mpi.getIndex();
+ if (idx >= 0) {
+ String name = mpi.getName().getLocalPart();
+ String type;
+ Class clz = paramClasses[idx];
+ if (clz.isArray()) {
+ if (isBuiltInTypes(clz.getComponentType())) {
+ type = clz.getComponentType().getSimpleName() + "[]";
+ } else {
+ type = clz.getComponentType().getName() + "[]";
+ }
+ } else {
+ type = clz.getName();
+ }
+ fields.add(new JavaField(name, type, ""));
+ }
+ }
+
+ return fields;
+ }
+
+ @Override
+ public WrapperBeanClass getWrapperBeanClass(final Method method) {
+ javax.xml.ws.ResponseWrapper resWrapper = method.getAnnotation(javax.xml.ws.ResponseWrapper.class);
+ String resClassName = getClassName();
+ String resNs = null;
+
+ if (resWrapper != null) {
+ resClassName = resWrapper.className().length() > 0 ? resWrapper.className() : resClassName;
+ resNs = resWrapper.targetNamespace().length() > 0 ? resWrapper.targetNamespace() : null;
+ }
+ if (resClassName == null) {
+ resClassName = getPackageName(method) + ".jaxws."
+ + AnnotationUtil.capitalize(method.getName())
+ + "Response";
+ }
+
+ WrapperBeanClass jClass = new WrapperBeanClass();
+ jClass.setFullClassName(resClassName);
+ jClass.setNamespace(resNs);
+ return jClass;
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/ResponseWrapper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java Fri May 18 09:39:38 2007
@@ -1,26 +1,26 @@
-/**
- * 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.cxf.tools.fortest.classnoanno.docwrapped;
-
-public class AddException extends Exception {
- public AddException(String message) {
- super(message);
- }
-}
+/**
+ * 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.cxf.tools.fortest.classnoanno.docwrapped;
+
+public class AddException extends Exception {
+ public AddException(String message) {
+ super(message);
+ }
+}
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/AddException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/Calculator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/Calculator.java?view=diff&rev=539517&r1=539516&r2=539517
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/Calculator.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/classnoanno/docwrapped/Calculator.java Fri May 18 09:39:38 2007
@@ -1,30 +1,30 @@
-/**
- * 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.cxf.tools.fortest.classnoanno.docwrapped;
-
-
-public class Calculator {
- public int add(int a, int b) throws AddException {
- if (a < 0 || b < 0) {
- throw new AddException("No negetive please");
- }
- return a + b;
- }
-}
+/**
+ * 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.cxf.tools.fortest.classnoanno.docwrapped;
+
+
+public class Calculator {
+ public int add(int a, int b) throws AddException {
+ if (a < 0 || b < 0) {
+ throw new AddException("No negetive please");
+ }
+ return a + b;
+ }
+}