You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2007/06/20 08:13:19 UTC

svn commit: r548948 - in /incubator/cxf/trunk: rt/core/src/main/java/org/apache/cxf/endpoint/ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ systests/ systests/src/test/java/org/apache/cxf/systest/jaxb/ systests/src/test/java/org/apache/cxf/sys...

Author: ffang
Date: Tue Jun 19 23:13:18 2007
New Revision: 548948

URL: http://svn.apache.org/viewvc?view=rev&rev=548948
Log:
[CXF-340] shouldn't pass class type to JAXB unmarshaller as argumentment if this class is abstract or interface

Added:
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java   (with props)
    incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml   (with props)
Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
    incubator/cxf/trunk/systests/pom.xml

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?view=diff&rev=548948&r1=548947&r2=548948
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Tue Jun 19 23:13:18 2007
@@ -72,7 +72,7 @@
     protected Bus bus;
     protected ConduitSelector conduitSelector;
     protected ClientOutFaultObserver outFaultObserver; 
-    protected int synchronousTimeout = 10000; // default 10 second timeout
+    protected int synchronousTimeout = 1000000; // default 10 second timeout
     
     protected PhaseChainCache outboundChainCache = new PhaseChainCache();
     protected PhaseChainCache inboundChainCache = new PhaseChainCache();

Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java?view=diff&rev=548948&r1=548947&r2=548948
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBEncoderDecoder.java Tue Jun 19 23:13:18 2007
@@ -22,6 +22,7 @@
 import java.io.OutputStream;
 import java.lang.reflect.Array;
 import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.Modifier;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.Arrays;
@@ -234,13 +235,21 @@
             if (au != null) {
                 u.setAttachmentUnmarshaller(au);
             }
+            boolean unmarshalWithClass = true;
+            
+            if (clazz == null || (!clazz.isPrimitive() && !clazz.isArray() && !clazz.isEnum() 
+                && (Modifier.isAbstract(clazz.getModifiers()) 
+                || Modifier.isInterface(clazz.getModifiers())))) {
+                unmarshalWithClass = false;
+            }
             if (source instanceof Node) {
-                obj = (clazz != null) ? u.unmarshal((Node)source, clazz) : u.unmarshal((Node)source);
+                obj = unmarshalWithClass ? u.unmarshal((Node)source, clazz) : u.unmarshal((Node)source);
             } else if (source instanceof XMLStreamReader) {
-                obj = (clazz != null) ? u.unmarshal((XMLStreamReader)source, clazz) : u
+                
+                obj = unmarshalWithClass ? u.unmarshal((XMLStreamReader)source, clazz) : u
                     .unmarshal((XMLStreamReader)source);
             } else if (source instanceof XMLEventReader) {
-                obj = (clazz != null) ? u.unmarshal((XMLEventReader)source, clazz) : u
+                obj = unmarshalWithClass ? u.unmarshal((XMLEventReader)source, clazz) : u
                     .unmarshal((XMLEventReader)source);
             } else {
                 throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE, source.getClass().getName()));

Modified: incubator/cxf/trunk/systests/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/pom.xml?view=diff&rev=548948&r1=548947&r2=548948
==============================================================================
--- incubator/cxf/trunk/systests/pom.xml (original)
+++ incubator/cxf/trunk/systests/pom.xml Tue Jun 19 23:13:18 2007
@@ -283,6 +283,11 @@
             <artifactId>spring-core</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-mock</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
             <scope>test</scope>

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,74 @@
+/**
+ * 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.systest.jaxb;
+
+
+import org.apache.cxf.systest.jaxb.model.ExtendedWidget;
+import org.apache.cxf.systest.jaxb.model.Widget;
+import org.apache.cxf.systest.jaxb.service.TestService;
+import org.junit.Test;
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+
+public class TestServiceTest extends AbstractDependencyInjectionSpringContextTests {
+
+    private TestService testClient;
+
+    public TestServiceTest() {
+        setAutowireMode(AbstractDependencyInjectionSpringContextTests.AUTOWIRE_BY_NAME);
+    }
+
+
+    @Test
+    public void testExtraSubClassWithJaxb() throws Throwable {
+
+        Widget expected = new ExtendedWidget(42, "blah", "blah", true, true);
+
+        Widget widgetFromService = testClient.getWidgetById((long)42);
+        System.out.println(widgetFromService.toString());
+
+        assertEquals(expected, widgetFromService);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.springframework.test.AbstractSingleSpringContextTests#getConfigLocations()
+     */
+    @Override
+    protected String[] getConfigLocations() {
+        return new String[] {"classpath:extrajaxbclass.xml"};
+    }
+
+    /**
+     * @return the testClient
+     */
+    public TestService getTestClient() {
+        return testClient;
+    }
+
+    /**
+     * @param testClient the testClient to set
+     */
+    public void setTestClient(TestService testClient) {
+        this.testClient = testClient;
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,103 @@
+/**
+ * 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.systest.jaxb.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+@XmlType(name = "extendedwidget", namespace = "http://cxf.org.apache/model")
+@XmlRootElement(name = "extendedwidget", namespace = "http://cxf.org.apache/model")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class ExtendedWidget extends Widget {
+
+    @XmlElement(required = true, namespace = "http://cxf.org.apache/model")
+    private boolean extended = true;
+
+    /**
+     * 
+     */
+    public ExtendedWidget() {
+        super();
+    }
+
+    /**
+     * @param id
+     * @param name
+     * @param serialNumber
+     * @param broken
+     * @param extended
+     */
+    public ExtendedWidget(long id, String name, String serialNumber, boolean broken, boolean extended) {
+        super(id, name, serialNumber, broken);
+        this.extended = extended;
+    }
+
+    /**
+     * @return the extended
+     */
+    public boolean isExtended() {
+        return extended;
+    }
+
+    /**
+     * @param extended the extended to set
+     */
+    public void setExtended(boolean extended) {
+        this.extended = extended;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        boolean ret = false;
+        if (obj instanceof ExtendedWidget) {
+            ExtendedWidget w = (ExtendedWidget)obj;
+            ret = new EqualsBuilder().appendSuper(true).append(extended, w.extended).isEquals();
+        }
+        
+        return ret;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this).appendSuper(super.toString()).append("extended", extended)
+            .toString();
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidget.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,162 @@
+/**
+ * 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.systest.jaxb.model;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * @author shade
+ */
+@XmlType(name = "widget", namespace = "http://cxf.org.apache/model")
+@XmlRootElement(name = "widget", namespace = "http://cxf.org.apache/model")
+@XmlAccessorType(XmlAccessType.FIELD)
+public abstract class Widget {
+
+    @XmlAttribute(required = true)
+    private long id;
+
+    @XmlElement(required = true, namespace = "http://cxf.org.apache/model")
+    private String name;
+
+    @XmlElement(required = false, namespace = "http://cxf.org.apache/model")
+    private String serialNumber;
+
+    @XmlElement(required = true, namespace = "http://cxf.org.apache/model")
+    private boolean broken;
+
+    /**
+     * 
+     */
+    public Widget() {
+        super();
+    }
+
+    /**
+     * @param id
+     * @param name
+     * @param serialNumber
+     * @param broken
+     */
+    public Widget(long id, String name, String serialNumber, boolean broken) {
+        super();
+        this.id = id;
+        this.name = name;
+        this.serialNumber = serialNumber;
+        this.broken = broken;
+    }
+
+    /**
+     * @return the id
+     */
+    public long getId() {
+        return id;
+    }
+
+    /**
+     * @param id the id to set
+     */
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    /**
+     * @return the name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return the serialNumber
+     */
+    public String getSerialNumber() {
+        return serialNumber;
+    }
+
+    /**
+     * @param serialNumber the serialNumber to set
+     */
+    public void setSerialNumber(String serialNumber) {
+        this.serialNumber = serialNumber;
+    }
+
+    /**
+     * @return the broken
+     */
+    public boolean isBroken() {
+        return broken;
+    }
+
+    /**
+     * @param broken the broken to set
+     */
+    public void setBroken(boolean broken) {
+        this.broken = broken;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        boolean ret = false;
+        if (obj instanceof Widget) {
+            Widget w = (Widget)obj;
+            ret = new EqualsBuilder().append(id, w.id).append(name, w.name).append(serialNumber,
+                                                                                   w.serialNumber)
+                .append(broken, w.broken).isEquals();
+        }
+        return ret;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this).append("id", id).append("name", name).append("serialNumber",
+                                                                                      serialNumber)
+            .append("broken", broken).toString();
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/Widget.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index Tue Jun 19 23:13:18 2007
@@ -0,0 +1,2 @@
+Widget
+ExtendedWidget
\ No newline at end of file

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,35 @@
+/**
+ * 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.systest.jaxb.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import org.apache.cxf.systest.jaxb.model.Widget;
+
+@WebService(targetNamespace = "http://cxf.org.apache/service")
+public interface TestService {
+
+    @WebMethod(operationName = "getWidgetById")
+    Widget getWidgetById(@WebParam(name = "id")
+                         long id);
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,38 @@
+/**
+ * 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.systest.jaxb.service;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.systest.jaxb.model.ExtendedWidget;
+import org.apache.cxf.systest.jaxb.model.Widget;
+/**
+ * @author shade
+ */
+@WebService(endpointInterface = "org.apache.cxf.systest.jaxb.service.TestService")
+public class TestServiceImpl implements TestService {
+
+    public Widget getWidgetById(long id) {
+        return new ExtendedWidget(id, "blah", "blah", true, true);
+    }
+
+    
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/service/TestServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java Tue Jun 19 23:13:18 2007
@@ -0,0 +1,77 @@
+/**
+ * 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.systest.jaxb.util;
+
+import java.util.List;
+
+import org.springframework.beans.factory.FactoryBean;
+
+public class ClassArrayFactoryBean implements FactoryBean {
+
+    private List<String> classNames;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.springframework.beans.factory.FactoryBean#getObject()
+     */
+    public Object getObject() throws Exception {
+
+        final Class<?>[] classes = new Class<?>[classNames.size()];
+        for (int i = 0; i < classNames.size(); i++) {
+            classes[i] = Class.forName(classNames.get(i));
+            System.out.println("Class: " + classes[i].toString());
+        }
+        return classes;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.springframework.beans.factory.FactoryBean#getObjectType()
+     */
+    public Class<?> getObjectType() {
+        return Class[].class;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.springframework.beans.factory.FactoryBean#isSingleton()
+     */
+    public boolean isSingleton() {
+        return true;
+    }
+
+    /**
+     * @return the classNames
+     */
+    public List<String> getClassNames() {
+        return classNames;
+    }
+
+    /**
+     * @param classNames the classNames to set
+     */
+    public void setClassNames(List<String> classNames) {
+        this.classNames = classNames;
+    }
+
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/util/ClassArrayFactoryBean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml?view=auto&rev=548948
==============================================================================
--- incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml (added)
+++ incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml Tue Jun 19 23:13:18 2007
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:jaxws="http://cxf.apache.org/jaxws"
+	xmlns:http="http://cxf.apache.org/transports/http/configuration"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+						http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+						http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd">
+						
+
+		
+	<!-- CXF -->
+	<import resource="classpath:META-INF/cxf/cxf.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
+
+
+	<!-- Services -->
+	<jaxws:server id="testServer" serviceClass="org.apache.cxf.systest.jaxb.service.TestService" address="http://localhost:7081/service/TestService">
+	
+		<jaxws:properties>
+			<entry key="jaxb.additionalContextClasses">
+				<bean class="org.apache.cxf.systest.jaxb.util.ClassArrayFactoryBean">
+					<property name="classNames">
+						<list>
+							<value>org.apache.cxf.systest.jaxb.model.ExtendedWidget</value>
+						</list>
+					</property>
+				</bean>
+			</entry>
+		</jaxws:properties>
+		
+		<jaxws:serviceBean>
+			<bean class="org.apache.cxf.systest.jaxb.service.TestServiceImpl" autowire="byName" />
+		</jaxws:serviceBean>
+		
+	</jaxws:server>
+	
+	
+	<!-- Client Proxy -->
+	<jaxws:client id="testClient" address="http://localhost:7081/service/TestService" serviceClass="org.apache.cxf.systest.jaxb.service.TestService">
+		<jaxws:inInterceptors>
+			<bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
+		</jaxws:inInterceptors>
+		<jaxws:outInterceptors>
+			<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
+		</jaxws:outInterceptors>
+	    <jaxws:properties>
+			<entry key="jaxb.additionalContextClasses">
+				<bean class="org.apache.cxf.systest.jaxb.util.ClassArrayFactoryBean">
+					<property name="classNames">
+						<list>
+							<value>org.apache.cxf.systest.jaxb.model.ExtendedWidget</value>
+						</list>
+					</property>
+				</bean>
+			</entry>
+        </jaxws:properties>	
+	</jaxws:client>
+	
+				
+</beans>
+

Propchange: incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/systests/src/test/resources/extrajaxbclass.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml