cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tam, William" <W...@iona.com>
Subject RE: svn commit: r469066 [1/3] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/configuration/spring/ common/common/src/test/java/org/apache/
Date Mon, 30 Oct 2006 16:51:02 GMT
Hi Dan,

Prior to this change, I was able to create a "new
JAXBDataBinding(myClazz)" where myClazz is an interface.  It looks like
I can no longer construct a JAXBDataBinding object with an interface.
The following is the stack trace.  It is important for me to be able to
pass an interface as opposed to an impl class.  Do you have any
suggestions? 

Regards,
William

Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1
counts of IllegalAnnotationExceptions
org.apache.hello_world_doc_lit.Greeter is an interface, and JAXB can't
handle interfaces.
        this problem is related to the following location:
                at org.apache.hello_world_doc_lit.Greeter

        at
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Il
legalAnnotationsException.java:66)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextIm
pl.java:361)
        at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:
217)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
        at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
        at
org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding.ja
va:257)
        at
org.apache.cxf.jaxb.JAXBDataBinding.<init>(JAXBDataBinding.java:90)
        at
org.mule.providers.wsdl.cxf.CxfMessageReceiver.createCxfServiceFactory(C
xfMessageReceiver.java:146)
        ... 30 more




-----Original Message-----
From: dandiep@apache.org [mailto:dandiep@apache.org] 
Sent: Sunday, October 29, 2006 11:56 PM
To: cxf-commits@incubator.apache.org
Subject: svn commit: r469066 [1/3] - in /incubator/cxf/trunk:
api/src/main/java/org/apache/cxf/databinding/
api/src/main/java/org/apache/cxf/service/model/
common/common/src/main/java/org/apache/cxf/configuration/spring/
common/common/src/test/java/org/apache/c...

Author: dandiep
Date: Sun Oct 29 20:56:21 2006
New Revision: 469066

URL: http://svn.apache.org/viewvc?view=rev&rev=469066
Log:
o Clean up JaxWsServiceFactory.setClassInfo and make it
readable/fixable.
o Add MessagePartInfo.typeClass as we are almost always binding a part
to
  a class eventually. The only case when we are not is when we're doing
  WSDL introspection (i.e. WSDL2Java), but it doesn't hurt things to
have
  get/setTypeClass there.
o Cleaned up JAXBDataBinding. Instead of walking the service model in
it,
  we utilize the service model to build up the context. This has the
following
  advantages:
  1. Not tied to JAX-WS
  2. Allows databinding of services which aren't backed by one class
  3. Reduces code duplication
o You'll realize JAXBDatabinding has a Class... constructor now. This
  does NOT walk classes anymore. It simply addes the classes to the
context. 
o I fixed up WSDLServiceBuilder a little bit so it set the XML schema,
  part name, and element names correctly.
o Give the DataReader a MessagePartInfo so it can look at the generic
type
  and grab the class info itself.
o Reworked the RPC namespace handling a bit. The net output should be 
  the exact same, but if something looks off let me know.
o Add a LoggingInInterceptor
o Support returning/receiving List<Foo> now (which is the reason I did
  all the above changes...)!

Added:
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java   (with props)
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBContextInitializer.java
      - copied, changed from r467469,
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBServiceModelInitializer.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java   (with props)
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/ServiceImplTest.java   (with props)
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/getGreetings.xml   (with props)
Removed:
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBServiceModelInitializer.java
Modified:
 
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataRea
der.java
 
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWri
ter.java
 
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Messa
gePartInfo.java
 
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Servi
ceModelUtil.java
 
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configura
tion/spring/SpringBeanMap.java
 
incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configura
tion/spring/SpringBeanMapTest.java
 
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/bindin
g/http/bare/BareServiceTest.java
 
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCInInterceptor.java
 
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCOutInterceptor.java
 
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/SoapOutInterceptor.java
 
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCInInterceptorTest.java
 
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCOutInterceptorTest.java
 
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/TestBase.java
 
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding
/xml/interceptor/XMLFaultOutInterceptor.java
 
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/TestBase.java
 
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageInInterceptorTest.java
 
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageOutInterceptorTest.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Abs
tractInDatabindingInterceptor.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eInInterceptor.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eOutInterceptor.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Cli
entFaultConverter.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Wra
ppedInInterceptor.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceW
SDLBuilder.java
 
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServ
iceBuilder.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBDataBinding.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBEncoderDecoder.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/EventDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/EventDataWriter.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/MessageDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/MessageDataWriter.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/NodeDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/NodeDataWriter.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/SOAPBodyDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/SOAPBodyDataWriter.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/SOAPMessageDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/XMLMessageDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/XMLStreamDataReader.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/io/XMLStreamDataWriter.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jax
b/BareInInterceptorTest.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jax
b/JAXBEncoderDecoderTest.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jax
b/TestBase.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jax
b/io/XMLStreamDataReaderTest.java
 
incubator/cxf/trunk/rt/databinding/jaxb/src/test/java/org/apache/cxf/jax
b/io/XMLStreamDataWriterTest.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/EndpointImpl.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/ServiceImpl.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/interceptors/DispatchInInterceptor.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/interceptors/WebFaultOutInterceptor.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/interceptors/WrapperClassInInterceptor.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/interceptors/WrapperClassOutInterceptor.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/support/JaxWsEndpointImpl.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/support/JaxWsServiceConfiguration.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/support/JaxWsServiceFactoryBean.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws
/support/ProviderServiceFactoryBean.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/CodeFirstTest.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/HeaderTest.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/JaxWsClientTest.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/sayHi.xml
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/service/Hello.java
 
incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws
/support/JaxWsServiceFactoryBeanTest.java
 
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/serv
ice/factory/AbstractServiceConfiguration.java
 
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/serv
ice/factory/DefaultServiceConfiguration.java
 
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/serv
ice/factory/ReflectionServiceFactoryBean.java
 
incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/serv
ice/factory/SimpleMethodDispatcher.java
 
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/serv
ice/factory/ClientFactoryBeanTest.java
 
incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/serv
ice/factory/ReflectionServiceFactoryTest.java
 
incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/impl/Pro
xy.java
 
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/C
lientMtomXopTest.java

Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataRea
der.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/a
pache/cxf/databinding/DataReader.java?view=diff&rev=469066&r1=469065&r2=
469066
========================================================================
======
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataRea
der.java (original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataRea
der.java Sun Oct 29 20:56:21 2006
@@ -21,8 +21,10 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.service.model.MessagePartInfo;
+
 public interface DataReader<T> {
     Object read(T input);
-    Object read(QName name, T input);
-    Object read(QName name, T input, Class<?> cls);
+    Object read(MessagePartInfo part, T input);
+    Object read(QName name, T input, Class type);
 }

Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWri
ter.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/a
pache/cxf/databinding/DataWriter.java?view=diff&rev=469066&r1=469065&r2=
469066
========================================================================
======
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWri
ter.java (original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/databinding/DataWri
ter.java Sun Oct 29 20:56:21 2006
@@ -19,9 +19,9 @@
 
 package org.apache.cxf.databinding;
 
-import javax.xml.namespace.QName;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 public interface DataWriter<T> {
     void write(Object obj, T output);
-    void write(Object obj, QName elName, T output);
+    void write(Object obj, MessagePartInfo part, T output);
 }

Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Messa
gePartInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/a
pache/cxf/service/model/MessagePartInfo.java?view=diff&rev=469066&r1=469
065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Messa
gePartInfo.java (original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Messa
gePartInfo.java Sun Oct 29 20:56:21 2006
@@ -32,8 +32,9 @@
     private QName elementName;
     private boolean isInSoapHeader;
     private XmlSchemaAnnotated xmlSchema;
+    private Class<?> typeClass;
     
-    MessagePartInfo(QName n, AbstractMessageContainer info) {
+    public MessagePartInfo(QName n, AbstractMessageContainer info) {
         mInfo = info;
         pname = n;
     }
@@ -99,5 +100,13 @@
 
     public void setXmlSchema(XmlSchemaAnnotated xmlSchema) {
         this.xmlSchema = xmlSchema;
+    }
+
+    public Class<?> getTypeClass() {
+        return typeClass;
+    }
+
+    public void setTypeClass(Class<?> typeClass) {
+        this.typeClass = typeClass;
     }
 }

Modified:
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Servi
ceModelUtil.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/a
pache/cxf/service/model/ServiceModelUtil.java?view=diff&rev=469066&r1=46
9065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Servi
ceModelUtil.java (original)
+++
incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/Servi
ceModelUtil.java Sun Oct 29 20:56:21 2006
@@ -71,13 +71,4 @@
         }
         return schemaInfo;
     }
-
-    public static QName getPartName(MessagePartInfo part) {
-        QName name = part.getElementQName();
-        if (name == null) {
-            name = part.getTypeQName();
-        }
-        return name;
-    }
-
 }

Modified:
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configura
tion/spring/SpringBeanMap.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/
java/org/apache/cxf/configuration/spring/SpringBeanMap.java?view=diff&re
v=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configura
tion/spring/SpringBeanMap.java (original)
+++
incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/configura
tion/spring/SpringBeanMap.java Sun Oct 29 20:56:21 2006
@@ -146,7 +146,11 @@
     }
 
     public Set<java.util.Map.Entry<String, V>> entrySet() {
-        throw new UnsupportedOperationException();
+        Set<Map.Entry<String, V>> entries = new
HashSet<Map.Entry<String, V>>();
+        for (String k : keySet()) {
+            entries.add(new Entry<V>(this, k));
+        }
+        return entries;
     }
 
     @SuppressWarnings("unchecked")
@@ -202,5 +206,27 @@
             values.add(get(id));
         }
         return values;
+    }
+    
+    public static class Entry<V> implements Map.Entry<String, V> {
+        private SpringBeanMap<V> map;
+        private String key;
+
+        public Entry(SpringBeanMap<V> map, String key) {
+            this.map = map;
+            this.key = key;
+        }
+        
+        public String getKey() {
+            return key;
+        }
+
+        public V getValue() {
+            return map.get(key);
+        }
+
+        public V setValue(V value) {
+            return map.put(key, value);
+        }
     }
 }

Modified:
incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configura
tion/spring/SpringBeanMapTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/test/
java/org/apache/cxf/configuration/spring/SpringBeanMapTest.java?view=dif
f&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configura
tion/spring/SpringBeanMapTest.java (original)
+++
incubator/cxf/trunk/common/common/src/test/java/org/apache/cxf/configura
tion/spring/SpringBeanMapTest.java Sun Oct 29 20:56:21 2006
@@ -20,6 +20,8 @@
 
 import java.util.Collection;
 import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
 
 import junit.framework.TestCase;
 
@@ -44,6 +46,11 @@
         Person p2 = values.iterator().next();
         assertNotNull(p2);
         assertEquals(p, p2);
+        
+        Set<Entry<String, Person>> entries = beans.entrySet();
+        Entry<String, Person> e = entries.iterator().next();
+        assertEquals("dan", e.getKey());
+        assertEquals(p, e.getValue());
         
         Person p3 = new PersonImpl();
         beans.put("foo", p3);

Modified:
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/bindin
g/http/bare/BareServiceTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/te
st/java/org/apache/cxf/binding/http/bare/BareServiceTest.java?view=diff&
rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/bindin
g/http/bare/BareServiceTest.java (original)
+++
incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/bindin
g/http/bare/BareServiceTest.java Sun Oct 29 20:56:21 2006
@@ -18,6 +18,9 @@
  */
 package org.apache.cxf.binding.http.bare;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.w3c.dom.Document;
 
 import org.apache.cxf.binding.BindingFactoryManager;
@@ -28,7 +31,6 @@
 import org.apache.cxf.endpoint.ServerImpl;
 import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.service.model.BindingOperationInfo;
-import org.apache.cxf.transport.http.JettyHTTPDestination;
 
 public class BareServiceTest extends AbstractRestTest {
     public void testCreation() throws Exception {
@@ -41,12 +43,13 @@
         sf.getServiceFactory().setWrapped(false);
         sf.setBindingFactory(new HttpBindingInfoFactoryBean());
         sf.setAddress("http://localhost:9001/");
-        sf.setStart(false);
+
+        Map<String, Object> props = new HashMap<String, Object>();
+        props.put("contextMatchStrategy", "stem");
+        sf.setProperties(props);
         
         ServerImpl svr = (ServerImpl) sf.create();
-        ((JettyHTTPDestination)
svr.getDestination()).setContextMatchStrategy("stem");
-        svr.start();
-                
+
         URIMapper mapper = (URIMapper)
svr.getEndpoint().getService().get(URIMapper.class.getName());
         assertNotNull(mapper);
         

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCInInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/ma
in/java/org/apache/cxf/binding/soap/interceptor/RPCInInterceptor.java?vi
ew=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCInInterceptor.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -24,6 +24,8 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
 import org.apache.cxf.interceptor.BareInInterceptor;
@@ -82,23 +84,23 @@
 
         StaxUtils.nextEvent(xmlReader);
         while (StaxUtils.toNextElement(xmlReader)) {
+            QName name = xmlReader.getName();
             int idx = parameters.size();
             MessagePartInfo p = msg.getMessageParts().get(idx);
             if (p == null) {
-                message.setContent(Exception.class, new
RuntimeException("Parameter " + xmlReader.getName()
-
+ " does not exist!"));
+                throw new SoapFault("Parameter " + xmlReader.getName()
+ " does not exist!",
+
((SoapMessage)message).getVersion().getSender());
             }
-            QName name = xmlReader.getName();
             QName elName = new
QName(operation.getOperationInfo().getName().getNamespaceURI(), 
                     p.getName().getLocalPart());
 
             if (!elName.getLocalPart().equals(name.getLocalPart())) {
                 String expMessage = "Parameter " + name + " does not
equal to the name ["
                                     + elName.getLocalPart() + "] in the
servicemodel!";
-                message.setContent(Exception.class, new
RuntimeException(expMessage));
+                throw new SoapFault(expMessage,
((SoapMessage)message).getVersion().getSender());
             }
             Object param = null;
-            param = dr.read(elName, message,
(Class)p.getProperty(Class.class.getName()));
+            param = dr.read(p, message);
             if (param != null) {
                 parameters.add(param);
             } else {

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/ma
in/java/org/apache/cxf/binding/soap/interceptor/RPCOutInterceptor.java?v
iew=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCOutInterceptor.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/RPCOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -21,13 +21,15 @@
 
 import java.util.List;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.helpers.NSStack;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -45,7 +47,6 @@
 
     public void handleMessage(Message message) {
         try {
-            
             NSStack nsStack = new NSStack();
             nsStack.push();
 
@@ -57,11 +58,15 @@
             XMLStreamWriter xmlWriter = getXMLStreamWriter(message);
             DataWriter<Message> dataWriter =
getMessageDataWriter(message);
 
-            String opNs = addOperationNode(nsStack, message,
xmlWriter);
+            addOperationNode(nsStack, message, xmlWriter);
 
             int countParts = 0;
             List<MessagePartInfo> parts = null;
 
+            System.out.println("operation " + operation);
+            System.out.println("name " + operation.getName());
+            System.out.println("output " + operation.getOutput());
+            
             if (!isRequestor(message)) {
                 parts =
operation.getOutput().getMessageInfo().getMessageParts();
             } else {
@@ -72,23 +77,22 @@
             if (countParts > 0) {
                 List<?> objs = (List<?>)
message.getContent(List.class);                
                 if (objs.size() < parts.size()) {
-                    message.setContent(Exception.class, new
RuntimeException(
-                                    "The number of arguments is not
equal!"));
+                    throw new SoapFault("The number of arguments is not
equal!", 
+                                        ((SoapMessage)
message).getVersion().getSender());
                 }
 
                 for (int idx = 0; idx < countParts; idx++) {
                     Object arg = objs.get(idx);
                     MessagePartInfo part = (MessagePartInfo)
parts.get(idx);
-                    QName elName = new QName(opNs,
part.getName().getLocalPart());
-                    dataWriter.write(arg, elName, message);
+
+                    dataWriter.write(arg, part, message);
                 }
             }
             // Finishing the writing.
             xmlWriter.writeEndElement();            
             message.getInterceptorChain().finishSubChain();
-        } catch (Exception e) {
-            e.printStackTrace();
-            message.setContent(Exception.class, e);
+        } catch (XMLStreamException e) {
+            throw new Fault(e);
         }
     }
 

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/SoapOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/ma
in/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?
view=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/SoapOutInterceptor.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/bindin
g/soap/interceptor/SoapOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -24,28 +24,21 @@
 import java.util.List;
 import java.util.ResourceBundle;
 
-
-
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Element;
 
-
-
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.databinding.DataWriterFactory;
-
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
-
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessagePartInfo;
@@ -161,9 +154,8 @@
                         
                         startedHeader = true;
                     }
-                    QName elName = ServiceModelUtil.getPartName(part);
                     DataWriter<XMLStreamWriter> dataWriter =
getDataWriter(message);
-                    dataWriter.write(arg, elName, xtw);
+                    dataWriter.write(arg, part, xtw);
                 }
                  
             }

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCInInterceptorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/te
st/java/org/apache/cxf/binding/soap/RPCInInterceptorTest.java?view=diff&
rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCInInterceptorTest.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCInInterceptorTest.java Sun Oct 29 20:56:21 2006
@@ -26,7 +26,6 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.cxf.binding.soap.interceptor.RPCInInterceptor;
-
 import org.apache.cxf.jaxb.JAXBDataBinding;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.Service;
@@ -34,7 +33,6 @@
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.hello_world_rpclit.types.MyComplexStruct;
-import org.apache.hello_world_soap_http.RPCLitGreeterImpl;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 
@@ -52,15 +50,13 @@
                 .toString());
         BindingInfo bi = si.getBinding(new QName(TNS,
"Greeter_SOAPBinding_RPCLit"));
         BindingOperationInfo boi = bi.getOperation(new QName(TNS,
OPNAME));
-
boi.getOperationInfo().getInput().getMessagePartByIndex(0).setProperty(C
lass.class.getName(), 
-                MyComplexStruct.class);
-
boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setProperty(
Class.class.getName(), 
-                MyComplexStruct.class);
+
boi.getOperationInfo().getInput().getMessagePartByIndex(0).setTypeClass(
MyComplexStruct.class);
+
boi.getOperationInfo().getOutput().getMessagePartByIndex(0).setTypeClass
(MyComplexStruct.class);
         soapMessage.getExchange().put(BindingOperationInfo.class, boi);
 
         control.reset(); 
         Service service = control.createMock(Service.class);
-        JAXBDataBinding dataBinding = new
JAXBDataBinding(RPCLitGreeterImpl.class);
+        JAXBDataBinding dataBinding = new
JAXBDataBinding(MyComplexStruct.class);
         service.getDataBinding();
         EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
         service.getServiceInfo();

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCOutInterceptorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/te
st/java/org/apache/cxf/binding/soap/RPCOutInterceptorTest.java?view=diff
&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCOutInterceptorTest.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/RPCOutInterceptorTest.java Sun Oct 29 20:56:21 2006
@@ -39,7 +39,6 @@
 import org.apache.cxf.staxutils.DepthXMLStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.hello_world_rpclit.types.MyComplexStruct;
-import org.apache.hello_world_soap_http.RPCLitGreeterImpl;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 
@@ -63,7 +62,7 @@
 
         control.reset();
         Service service = control.createMock(Service.class);
-        JAXBDataBinding dataBinding = new
JAXBDataBinding(RPCLitGreeterImpl.class);
+        JAXBDataBinding dataBinding = new
JAXBDataBinding(MyComplexStruct.class);
         service.getDataBinding();
         EasyMock.expectLastCall().andReturn(dataBinding).anyTimes();
         service.getServiceInfo();

Modified:
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/TestBase.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/te
st/java/org/apache/cxf/binding/soap/TestBase.java?view=diff&rev=469066&r
1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/TestBase.java (original)
+++
incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/bindin
g/soap/TestBase.java Sun Oct 29 20:56:21 2006
@@ -30,7 +30,6 @@
 import javax.wsdl.Service;
 import javax.wsdl.factory.WSDLFactory;
 import javax.wsdl.xml.WSDLReader;
-import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
@@ -39,9 +38,6 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.jaxb.JAXBDataReaderFactory;
-import org.apache.cxf.jaxb.JAXBDataWriterFactory;
-import org.apache.cxf.jaxb.JAXBEncoderDecoder;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.service.model.BindingInfo;
@@ -140,19 +136,5 @@
         serviceInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION,
null);
         serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SERVICE, null);
         return serviceInfo;
-    }
-
-    protected JAXBDataReaderFactory getTestReaderFactory(Class<?> clz)
throws Exception {
-        JAXBContext ctx =
JAXBEncoderDecoder.createJAXBContextForClass(clz);
-        JAXBDataReaderFactory readerFacotry = new
JAXBDataReaderFactory();
-        readerFacotry.setJAXBContext(ctx);
-        return readerFacotry;
-    }
-
-    protected JAXBDataWriterFactory getTestWriterFactory(Class<?> clz)
throws Exception {
-        JAXBContext ctx =
JAXBEncoderDecoder.createJAXBContextForClass(clz);
-        JAXBDataWriterFactory writerFacotry = new
JAXBDataWriterFactory();
-        writerFacotry.setJAXBContext(ctx);
-        return writerFacotry;
     }
 }

Modified:
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding
/xml/interceptor/XMLFaultOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/mai
n/java/org/apache/cxf/binding/xml/interceptor/XMLFaultOutInterceptor.jav
a?view=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding
/xml/interceptor/XMLFaultOutInterceptor.java (original)
+++
incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding
/xml/interceptor/XMLFaultOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -22,7 +22,6 @@
 import java.util.Iterator;
 import java.util.ResourceBundle;
 
-import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -73,11 +72,11 @@
             // call data writer to marshal exception
             BindingOperationInfo bop =
message.getExchange().get(BindingOperationInfo.class);
             if (bop != null) {
-                QName elName = null;
                 if (!bop.isUnwrappedCapable()) {
                     bop = bop.getUnwrappedOperation();
                 }
                 Iterator<FaultInfo> it =
bop.getOperationInfo().getFaults().iterator();
+                MessagePartInfo part = null;
                 while (it.hasNext()) {
                     FaultInfo fi = it.next();
                     for (MessagePartInfo mpi : fi.getMessageParts()) {
@@ -85,20 +84,16 @@
                         Method method =
t.getClass().getMethod("getFaultInfo", new Class[0]);
                         Class sub = method.getReturnType();
                         if (cls != null && cls.equals(sub)) {
-                            if (mpi.isElement()) {
-                                elName = mpi.getElementQName();
-                            } else {
-                                elName = mpi.getTypeQName();
-                            }
+                            part = mpi;
                             break;
                         }
                     }
                 }
-                if (elName != null) {
+                if (part != null) {
                     StaxUtils.writeStartElement(writer, prefix,
XMLFault.XML_FAULT_DETAIL,
                             XMLConstants.NS_XML_FORMAT);
                     DataWriter<Message> dataWriter =
getMessageDataWriter(message);
-                    dataWriter.write(getFaultInfo(t), elName, message);
+                    dataWriter.write(getFaultInfo(t), part, message);
                     writer.writeEndElement();
                 }
             }

Modified:
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/TestBase.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/tes
t/java/org/apache/cxf/binding/xml/interceptor/TestBase.java?view=diff&re
v=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/TestBase.java (original)
+++
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/TestBase.java Sun Oct 29 20:56:21 2006
@@ -39,9 +39,6 @@
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.EndpointImpl;
 import org.apache.cxf.jaxb.JAXBDataBinding;
-import org.apache.cxf.jaxb.JAXBDataReaderFactory;
-import org.apache.cxf.jaxb.JAXBDataWriterFactory;
-import org.apache.cxf.jaxb.JAXBEncoderDecoder;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.Message;
@@ -111,22 +108,8 @@
         }
         return null;
     }
-
-    protected JAXBDataReaderFactory getTestReaderFactory(Class<?> clz)
throws Exception {
-        JAXBContext ctx =
JAXBEncoderDecoder.createJAXBContextForClass(clz);
-        JAXBDataReaderFactory readerFacotry = new
JAXBDataReaderFactory();
-        readerFacotry.setJAXBContext(ctx);
-        return readerFacotry;
-    }
-
-    protected JAXBDataWriterFactory getTestWriterFactory(Class<?> clz)
throws Exception {
-        JAXBContext ctx =
JAXBEncoderDecoder.createJAXBContextForClass(clz);
-        JAXBDataWriterFactory writerFacotry = new
JAXBDataWriterFactory();
-        writerFacotry.setJAXBContext(ctx);
-        return writerFacotry;
-    }
     
-    protected void common(String wsdl, QName portName, Class seiClazz)
throws Exception {
+    protected void common(String wsdl, QName portName, Class...
jaxbClasses) throws Exception {
         control = EasyMock.createNiceControl();
         
         bus = control.createMock(Bus.class);
@@ -154,7 +137,9 @@
         Binding xmlBinding = new
XMLBindingFactory().createBinding(epi.getBinding());
 
         control.reset();
-        service.setDataBinding(new JAXBDataBinding(seiClazz));
+        JAXBDataBinding db = new JAXBDataBinding();
+        db.setContext(JAXBContext.newInstance(jaxbClasses));
+        service.setDataBinding(db);
 
         Endpoint endpoint = control.createMock(EndpointImpl.class);
         EasyMock.expect(endpoint.getEndpointInfo()).andStubReturn(epi);

Modified:
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageInInterceptorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/tes
t/java/org/apache/cxf/binding/xml/interceptor/XMLMessageInInterceptorTes
t.java?view=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageInInterceptorTest.java (original)
+++
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageInInterceptorTest.java Sun Oct 29 20:56:21
2006
@@ -25,7 +25,6 @@
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.service.model.OperationInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.hello_world_xml_http.bare.types.MyComplexStructType;
@@ -45,7 +44,12 @@
         String ns = "http://apache.org/hello_world_xml_http/bare";
         prepareMessage("/message-bare-multi-param.xml");
         common("/wsdl/hello_world_xml_bare.wsdl", new QName(ns,
"XMLPort"),
-
org.apache.hello_world_xml_http.bare.Greeter.class);
+                        MyComplexStructType.class);
+        
+        OperationInfo op = serviceInfo.getInterface().getOperation(new
QName(ns, "testMultiParamPart"));
+
op.getInput().getMessagePartByIndex(0).setTypeClass(MyComplexStructType.
class);
+
op.getInput().getMessagePartByIndex(1).setTypeClass(String.class);
+        
         in.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
@@ -58,8 +62,11 @@
     public void testHandleMessageOnBareSingleChild() throws Exception {
         String ns = "http://apache.org/hello_world_xml_http/bare";
         prepareMessage("/message-bare-single-param-element.xml");
-        common("/wsdl/hello_world_xml_bare.wsdl", new QName(ns,
"XMLPort"),
-
org.apache.hello_world_xml_http.bare.Greeter.class);
+        common("/wsdl/hello_world_xml_bare.wsdl", new QName(ns,
"XMLPort"));
+        
+        OperationInfo op = serviceInfo.getInterface().getOperation(new
QName(ns, "greetMe"));
+
op.getInput().getMessagePartByIndex(0).setTypeClass(String.class);
+        
         in.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);
         assertNotNull(list);
@@ -71,10 +78,10 @@
         String ns = "http://apache.org/hello_world_xml_http/wrapped";
         prepareMessage("/message-wrap.xml");
         common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(ns,
"XMLPort"),
-
org.apache.hello_world_xml_http.wrapped.Greeter.class);
+               GreetMe.class);
         
         OperationInfo op = serviceInfo.getInterface().getOperation(new
QName(ns, "greetMe"));
-
op.getUnwrappedOperation().getInput().setProperty(WrappedInInterceptor.W
RAPPER_CLASS, GreetMe.class);
+
op.getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
         
         in.handleMessage(xmlMessage);
         List list = xmlMessage.getContent(List.class);

Modified:
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageOutInterceptorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/tes
t/java/org/apache/cxf/binding/xml/interceptor/XMLMessageOutInterceptorTe
st.java?view=diff&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageOutInterceptorTest.java (original)
+++
incubator/cxf/trunk/rt/bindings/xml/src/test/java/org/apache/cxf/binding
/xml/interceptor/XMLMessageOutInterceptorTest.java Sun Oct 29 20:56:21
2006
@@ -82,7 +82,7 @@
         params.add(myComplexStruct);
 
         common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs,
"XMLPort"),
-
org.apache.hello_world_xml_http.bare.Greeter.class);
+                        MyComplexStructType.class);
 
         BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs,
"Greeter_XMLBinding"));
         BindingOperationInfo boi = bi.getOperation(new QName(bareNs,
"sendReceiveData"));
@@ -112,7 +112,7 @@
         params.add("tli");
 
         common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs,
"XMLPort"),
-
org.apache.hello_world_xml_http.bare.Greeter.class);
+                        MyComplexStructType.class);
 
         BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs,
"Greeter_XMLBinding"));
         BindingOperationInfo boi = bi.getOperation(new QName(bareNs,
"testMultiParamPart"));
@@ -153,8 +153,7 @@
         GreetMe greetMe = new GreetMe();
         greetMe.setRequestType("tli");
         params.add(greetMe);
-        common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(wrapNs,
"XMLPort"),
-
org.apache.hello_world_xml_http.wrapped.Greeter.class);
+        common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(wrapNs,
"XMLPort"), GreetMe.class);
 
         BindingInfo bi = super.serviceInfo.getBinding(new QName(wrapNs,
"Greeter_XMLBinding"));
         BindingOperationInfo boi = bi.getOperation(new QName(wrapNs,
"greetMe"));

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Abs
tractInDatabindingInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/AbstractInDatabindingInterceptor.java?view=dif
f&rev=469066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Abs
tractInDatabindingInterceptor.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Abs
tractInDatabindingInterceptor.java Sun Oct 29 20:56:21 2006
@@ -138,7 +138,12 @@
     
     protected DepthXMLStreamReader getXMLStreamReader(Message message)
{
         XMLStreamReader xr = message.getContent(XMLStreamReader.class);
-        return new DepthXMLStreamReader(xr);
+        if (xr instanceof DepthXMLStreamReader) {
+            return (DepthXMLStreamReader) xr;
+        }
+        DepthXMLStreamReader dr = new DepthXMLStreamReader(xr);
+        message.setContent(XMLStreamReader.class, dr);
+        return dr;
     }
 
     /**

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eInInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/BareInInterceptor.java?view=diff&rev=469066&r1
=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eInInterceptor.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -100,12 +100,7 @@
                 throw new Fault(new
org.apache.cxf.common.i18n.Message("NO_PART_FOUND", BUNDLE, elName));
             }
             
-            Class<?> cls = (Class)
p.getProperty(Class.class.getName());
-            if (cls != null && !filter.contains(cls.getName()) &&
!cls.isArray()) {
-                o = dr.read(p.getConcreteName(), message, cls);
-            } else {
-                o = dr.read(p.getConcreteName(), message, null);
-            }
+            o = dr.read(p, message);
             
             if (o != null) {
                 parameters.add(o);

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eOutInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/BareOutInterceptor.java?view=diff&rev=469066&r
1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eOutInterceptor.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Bar
eOutInterceptor.java Sun Oct 29 20:56:21 2006
@@ -74,7 +74,7 @@
                         continue;
                     }
                     
-                    dataWriter.write(arg, part.getConcreteName(),
message);
+                    dataWriter.write(arg, part, message);
                 }
             }
         }

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Cli
entFaultConverter.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/ClientFaultConverter.java?view=diff&rev=469066
&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Cli
entFaultConverter.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Cli
entFaultConverter.java Sun Oct 29 20:56:21 2006
@@ -59,21 +59,17 @@
     protected void processFaultDetail(Fault fault, Message msg) {
         Element exDetail = (Element)
DOMUtils.getChild(fault.getDetail(), Node.ELEMENT_NODE);
         QName qname = new QName(exDetail.getNamespaceURI(),
exDetail.getLocalName());
-        FaultInfo faultWanted = null;        
-        Class cls = null;
+        FaultInfo faultWanted = null;    
+        MessagePartInfo part = null;
         BindingOperationInfo boi =
msg.getExchange().get(BindingOperationInfo.class);
+        if (boi.isUnwrapped()) {
+            boi = boi.getWrappedOperation();
+        }
         for (FaultInfo faultInfo : boi.getOperationInfo().getFaults())
{
             for (MessagePartInfo mpi : faultInfo.getMessageParts()) {
-                String ns = null;
-                if (mpi.isElement()) {
-                    ns = mpi.getElementQName().getNamespaceURI();
-                } else {
-                    ns = mpi.getTypeQName().getNamespaceURI();
-                }
-                if
(qname.getLocalPart().equals(mpi.getConcreteName().getLocalPart()) 
-                        && qname.getNamespaceURI().equals(ns)) {
-                    cls =
(Class)mpi.getProperty(Class.class.getName());
+                if (qname.equals(mpi.getConcreteName())) {
                     faultWanted = faultInfo;
+                    part = mpi;
                     break;
                 }
             }
@@ -90,7 +86,7 @@
         DataBinding dataBinding = s.getDataBinding();
 
         DataReader<Node> reader =
dataBinding.getDataReaderFactory().createReader(Node.class);
-        Object e = reader.read(qname, exDetail, cls);
+        Object e = reader.read(part, exDetail);
 
         if (!(e instanceof Exception)) {
             Class exClass =
faultWanted.getProperty(Class.class.getName(), Class.class);

Added:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/LoggingInInterceptor.java?view=auto&rev=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java (added)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -0,0 +1,82 @@
+/**
+ * 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.interceptor;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.helpers.IOUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+
+/**
+ * A simple logging handler which outputs the bytes of the message to
the
+ * Logger.
+ */
+public class LoggingInInterceptor extends
AbstractPhaseInterceptor<Message> {
+
+    private static final Logger LOG =
LogUtils.getL7dLogger(LoggingInInterceptor.class);
+
+    public LoggingInInterceptor() {
+        super();
+        setPhase(Phase.RECEIVE);
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        InputStream is = message.getContent(InputStream.class);
+
+        if (is == null) {
+            return;
+        }
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        try {
+            IOUtils.copy(is, bos);
+
+            is.close();
+            bos.close();
+
+            LOG.info("Message: " + bos.toString());
+
+            message.setContent(InputStream.class, new
ByteArrayInputStream(bos.toByteArray()));
+
+        } catch (IOException e) {
+            throw new Fault(e);
+        }
+    }
+    
+    public static void copy(final InputStream input,
+                            final OutputStream output,
+                            final int bufferSize)
+        throws IOException {
+        final byte[] buffer = new byte[bufferSize];
+        int n = 0;
+        n = input.read(buffer);
+        while (-1 != n) {
+            output.write(buffer, 0, n);
+            n = input.read(buffer);
+        }
+    }
+}

Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java
------------------------------------------------------------------------
------
    svn:eol-style = native

Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java
------------------------------------------------------------------------
------
    svn:executable = *

Propchange:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Log
gingInInterceptor.java
------------------------------------------------------------------------
------
    svn:keywords = Rev Date

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Wra
ppedInInterceptor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/interceptor/WrappedInInterceptor.java?view=diff&rev=469066
&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Wra
ppedInInterceptor.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/Wra
ppedInInterceptor.java Sun Oct 29 20:56:21 2006
@@ -39,7 +39,6 @@
 import org.apache.cxf.staxutils.StaxUtils;
 
 public class WrappedInInterceptor extends
AbstractInDatabindingInterceptor {
-    public static final String WRAPPER_CLASS = "wrapper.class";
     private static final ResourceBundle BUNDLE =
BundleUtils.getBundle(WrappedInInterceptor.class);
 
     public WrappedInInterceptor() {
@@ -76,15 +75,14 @@
         DataReader<Message> dr = getMessageDataReader(message);
         List<Object> objects;
 
+        MessageInfo msgInfo = setMessage(message, operation,
requestor);
+        
         // Determine if there is a wrapper class
         if ((operation.isUnwrapped() || operation.isUnwrappedCapable())
-            &&
operation.getOperationInfo().getUnwrappedOperation().getInput()
-                .getProperty(WRAPPER_CLASS) != null) {
+            && msgInfo.getMessageParts().get(0).getTypeClass() != null)
{
             objects = new ArrayList<Object>();
-            Object wrappedObject = dr.read(message);
+            Object wrappedObject =
dr.read(msgInfo.getMessageParts().get(0), message);
             objects.add(wrappedObject);
-
-            setMessage(message, operation, requestor);
         } else {
             // Unwrap each part individually if we don't have a wrapper
             objects = new ArrayList<Object>();
@@ -93,7 +91,7 @@
                 operation = operation.getUnwrappedOperation();
             }
 
-            MessageInfo msgInfo = setMessage(message, operation,
requestor);
+            msgInfo = setMessage(message, operation, requestor);
             List<MessagePartInfo> messageParts =
msgInfo.getMessageParts();
             Iterator<MessagePartInfo> itr = messageParts.iterator();
 
@@ -105,8 +103,7 @@
             // loop through each child element
             while (StaxUtils.toNextElement(xmlReader)) {
                 MessagePartInfo part = itr.next();
-                Class c =
(Class)part.getProperty(Class.class.getName());
-                objects.add(dr.read(part.getConcreteName(), message,
c));
+                objects.add(dr.read(part, message));
             }
 
         }

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceW
SDLBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/wsdl11/ServiceWSDLBuilder.java?view=diff&rev=469066&r1=469
065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceW
SDLBuilder.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceW
SDLBuilder.java Sun Oct 29 20:56:21 2006
@@ -111,18 +111,6 @@
 
 
     public List<ExtensibilityElement>
getWSDL11Extensors(AbstractPropertiesHolder holder) {
-//        List<?> extensors = holder.getExtensors()
-//        if (extensors.get() == null) {
-//            return null;
-//        }
-//        List<ExtensibilityElement> list
-//            = new
ArrayList<ExtensibilityElement>(extensors.get().length);
-//        for (Object obj : extensors.get()) {
-//            if (obj instanceof ExtensibilityElement) {
-//                list.add((ExtensibilityElement)obj);
-//            }
-//        }
-//        return Collections.unmodifiableList(list);
         return holder.getExtensors(ExtensibilityElement.class);
     }
     

Modified:
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServ
iceBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/o
rg/apache/cxf/wsdl11/WSDLServiceBuilder.java?view=diff&rev=469066&r1=469
065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServ
iceBuilder.java (original)
+++
incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServ
iceBuilder.java Sun Oct 29 20:56:21 2006
@@ -479,13 +479,22 @@
                 }
                 XmlSchemaElement el = (XmlSchemaElement)o;
 
-                // Handle anonymous ref
-                QName elQname = el.getQName();
-                if (elQname == null) {
-                    elQname = new QName(namespaceURI,
el.getRefName().getLocalPart());
+                if (el.getSchemaTypeName() != null) {
+                    MessagePartInfo mpi = wrapper.addMessagePart(new
QName(namespaceURI, el.getName()));
+                    mpi.setTypeQName(el.getSchemaTypeName());
+                    mpi.setXmlSchema(el);
+                } else if (el.getRefName() != null) {
+                    MessagePartInfo mpi =
wrapper.addMessagePart(el.getRefName());
+                    mpi.setTypeQName(el.getRefName());
+                    mpi.setXmlSchema(el);
+                } else {
+                    // anonymous type
+                    MessagePartInfo mpi = wrapper.addMessagePart(
+                        new QName(namespaceURI, el.getName()));
+                    mpi.setElementQName(mpi.getName());
+                    mpi.setElement(true);
+                    mpi.setXmlSchema(el);
                 }
-                MessagePartInfo mpi = wrapper.addMessagePart(elQname); 
-                mpi.setTypeQName(el.getSchemaTypeName());
             }
 
             return true;

Copied:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBContextInitializer.java (from r467469,
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBServiceModelInitializer.java)
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src
/main/java/org/apache/cxf/jaxb/JAXBContextInitializer.java?view=diff&rev
=469066&p1=incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apa
che/cxf/jaxb/JAXBServiceModelInitializer.java&r1=467469&p2=incubator/cxf
/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/JAXBContext
Initializer.java&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBServiceModelInitializer.java (original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBContextInitializer.java Sun Oct 29 20:56:21 2006
@@ -19,66 +19,121 @@
 
 package org.apache.cxf.jaxb;
 
+import java.lang.reflect.Array;
+import java.lang.reflect.GenericArrayType;
+import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.util.Collection;
+import java.util.Set;
 
-import javax.xml.namespace.QName;
-
-import
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
-import com.sun.xml.bind.v2.model.core.Element;
-import com.sun.xml.bind.v2.model.core.NonElement;
-import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
+import javax.xml.ws.Holder;
 
+import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.service.ServiceModelVisitor;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
 
 /**
- * Walks the service model and sets up the element/type names.
+ * Walks the service model and sets up the classes for the context.
  */
-class JAXBServiceModelInitializer extends ServiceModelVisitor {
+class JAXBContextInitializer extends ServiceModelVisitor {
 
-    private XmlSchemaCollection schemas;
+    private Set<Class<?>> classes;
 
-    public JAXBServiceModelInitializer(ServiceInfo serviceInfo,
XmlSchemaCollection col) {
+    public JAXBContextInitializer(ServiceInfo serviceInfo,
Set<Class<?>> classes) {
         super(serviceInfo);
-        schemas = col;
+        this.classes = classes;
     }
 
     @Override
     public void begin(MessagePartInfo part) {
-        // Check to see if the WSDL information has been filled in for
us.
-        if (part.getTypeQName() != null || part.getElementQName() !=
null) {
-            return;
-        }
-        
-        Class<?> clazz =
(Class<?>)part.getProperty(Class.class.getName());
+        Class<?> clazz = part.getTypeClass();
         if (clazz == null) {
             return;
         }
 
-        RuntimeModelBuilder builder = new RuntimeModelBuilder(new
RuntimeInlineAnnotationReader(), null);
-        NonElement<Type, Class> typeInfo = builder.getTypeInfo(clazz,
null);
+        Type genericType = (Type) part.getProperty("generic.type");
+        if (genericType != null) {
+            addType(genericType);
+            
+            if (Collection.class.isAssignableFrom(clazz) 
+                && genericType instanceof ParameterizedType) {
+                ParameterizedType pt = (ParameterizedType) genericType;
+                if (pt.getActualTypeArguments().length > 0 
+                    && pt.getActualTypeArguments()[0] instanceof Class)
{
+            
+                    Class<? extends Object> arrayCls = 
+                        Array.newInstance((Class)
pt.getActualTypeArguments()[0], 0).getClass();
+                    clazz = arrayCls;
+                    part.setTypeClass(clazz);
+                }
+            }
+        }
+        addClass(clazz);
+    }
+    
+    private void addType(Type cls) {
+        if (cls instanceof Class) {
+            addClass((Class)cls);
+        } else if (cls instanceof ParameterizedType) {
+            for (Type t2 :
((ParameterizedType)cls).getActualTypeArguments()) {
+                addType(t2);
+            }
+        } else if (cls instanceof GenericArrayType) {
+            GenericArrayType gt = (GenericArrayType)cls;
+            Class ct = (Class) gt.getGenericComponentType();
+            ct = Array.newInstance(ct, 0).getClass();
+            
+            addClass(ct);
+        }
+    }
+    
 
-        QName typeName = typeInfo.getTypeName();
-        // TODO: this doesn't seem to work with elements yet
-        if (typeName == null) {
+    private  void addClass(Class<?> cls) {
+        if (cls.isArray() && cls.getComponentType().isPrimitive()) {
             return;
         }
+        cls = getValidClass(cls);
+        if (null != cls) {
+            if (cls.isEnum()) {
+                // The object factory stuff doesn't work for enums
+                classes.add(cls);
+            }
+            String name = PackageUtils.getPackageName(cls) +
".ObjectFactory";
+            try {
+                cls = Class.forName(name, false, cls.getClassLoader());
+                if (cls != null) {
+                    classes.add(cls);
+                }
+            } catch (ClassNotFoundException ex) {
+                // cannot add factory, just add the class
+                classes.add(cls);
+            }
+        }
+    }
 
-        boolean isElement = typeInfo instanceof Element;
-        if (isElement) {
-            isElement = ((Element) typeInfo).getElementName() != null;
+    private static Class<?> getValidClass(Class<?> cls) {
+        if (cls.isEnum()) {
+            return cls;
+        }
+        if (cls.isArray()) {
+            return cls;
         }
 
-        part.setElement(isElement);
-        if (isElement) {
-            QName name = ((Element) typeInfo).getElementName();
-            part.setElementQName(name);
-            part.setXmlSchema(schemas.getElementByQName(name));
-        } else {
-            part.setTypeQName(typeName);
-            part.setXmlSchema(schemas.getTypeByQName(typeName));
+        if (cls == Object.class || cls == String.class || cls ==
Holder.class) {
+            cls = null;
+        } else if (cls.isPrimitive() || cls.isInterface() ||
cls.isAnnotation()) {
+            cls = null;
+        }
+        if (cls != null) {
+            try {
+                if (cls.getConstructor(new Class[0]) == null) {
+                    cls = null;
+                }
+            } catch (NoSuchMethodException ex) {
+                cls = null;
+            }
         }
+        return cls;
     }
 }

Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBDataBinding.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src
/main/java/org/apache/cxf/jaxb/JAXBDataBinding.java?view=diff&rev=469066
&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBDataBinding.java (original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBDataBinding.java Sun Oct 29 20:56:21 2006
@@ -21,11 +21,14 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.ResourceBundle;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -73,16 +76,23 @@
 
     Class cls;
 
-    public JAXBDataBinding() throws JAXBException {
+    public JAXBDataBinding() {
         reader = new JAXBDataReaderFactory();
         writer = new JAXBDataWriterFactory();
     }
+    
+    public JAXBDataBinding(Class<?>...classes) throws JAXBException {
+        reader = new JAXBDataReaderFactory();
+        writer = new JAXBDataWriterFactory();
+        
+        Set<Class<?>> classSet = new HashSet<Class<?>>();
+        classSet.addAll(Arrays.asList(classes));
+        setContext(createJAXBContext(classSet));
+    }
 
-    public JAXBDataBinding(Class<?> cls) throws JAXBException {
+    public JAXBDataBinding(JAXBContext context) {
         this();
-        context = JAXBEncoderDecoder.createJAXBContextForClass(cls);
-        reader.setJAXBContext(context);
-        writer.setJAXBContext(context);
+        setContext(context);
     }
 
     public void setContext(JAXBContext ctx) {
@@ -159,6 +169,17 @@
     }
 
     public void initialize(ServiceInfo serviceInfo) {
+        Set<Class<?>> classes = new HashSet<Class<?>>();
+        JAXBContextInitializer initializer = 
+            new JAXBContextInitializer(serviceInfo, classes);
+        initializer.walk();
+
+        try {
+            setContext(createJAXBContext(classes));
+        } catch (JAXBException e1) {
+            throw new ServiceConstructionException(e1);
+        }
+        
         XmlSchemaCollection col = (XmlSchemaCollection)serviceInfo
             .getProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST);
 
@@ -190,6 +211,7 @@
 
                 SchemaInfo schema = new SchemaInfo(typeInfo, ns);
                 schema.setElement(d.getDocumentElement());
+                typeInfo.addSchema(schema);
                 col.read(d.getDocumentElement());
             }
         } catch (IOException e) {
@@ -197,8 +219,8 @@
         }
 
         serviceInfo.setProperty(WSDLServiceBuilder.WSDL_SCHEMA_LIST,
col);
-        JAXBServiceModelInitializer initializer = new
JAXBServiceModelInitializer(serviceInfo, col);
-        initializer.walk();
+        JAXBSchemaInitializer schemaInit = new
JAXBSchemaInitializer(serviceInfo, col);
+        schemaInit.walk();
 
     }
 
@@ -210,7 +232,6 @@
             public Result createOutput(String ns, String file) throws
IOException {
                 DOMResult result = new DOMResult();
                 result.setSystemId(file);
-
                 results.add(result);
 
                 return result;
@@ -219,4 +240,21 @@
 
         return results;
     }
+    
+
+
+    public static JAXBContext createJAXBContext(Set<Class<?>> classes)
throws JAXBException {
+        try {
+
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.AttributedQ
NameType"));
+
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ObjectFacto
ry"));
+
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ServiceName
Type"));
+        } catch (ClassNotFoundException e) {
+            // REVISIT - ignorable if WS-ADDRESSING not available?
+            // maybe add a way to allow interceptors to add stuff to
the
+            // context?
+        }
+       
+        return  JAXBContext.newInstance(classes.toArray(new
Class[classes.size()]));
+    }
+
 }

Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/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=469
066&r1=469065&r2=469066
========================================================================
======
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBEncoderDecoder.java (original)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBEncoderDecoder.java Sun Oct 29 20:56:21 2006
@@ -19,20 +19,15 @@
 
 package org.apache.cxf.jaxb;
 
-import java.lang.annotation.Annotation;
 import java.lang.reflect.Array;
 import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.util.Collection;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.ResourceBundle;
 import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
 
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
@@ -47,17 +42,13 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.validation.Schema;
-import javax.xml.ws.Holder;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-import javax.xml.ws.WebEndpoint;
 
 import org.w3c.dom.Node;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.service.model.MessagePartInfo;
 
 /**
  * JAXBEncoderDecoder
@@ -67,187 +58,14 @@
 public final class JAXBEncoderDecoder {
     private static final ResourceBundle BUNDLE =
BundleUtils.getBundle(JAXBEncoderDecoder.class);
 
-    private static Map<Class<?>, JAXBContext> contextMap = new
ConcurrentHashMap<Class<?>, JAXBContext>();
-
-    private JAXBEncoderDecoder() {
-    }
-
-    public static JAXBContext createJAXBContextForClass(Class<?> cls)
throws JAXBException {
-        JAXBContext context = contextMap.get(cls);
-        if (context == null) {
-            Set<Class<?>> classes = new HashSet<Class<?>>();
-            getClassesForContext(cls, classes, cls.getClassLoader());
-
-            try {
-
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.AttributedQ
NameType"));
-
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ObjectFacto
ry"));
-
classes.add(Class.forName("org.apache.cxf.ws.addressing.wsdl.ServiceName
Type"));
-            } catch (ClassNotFoundException e) {
-                // REVISIT - ignorable if WS-ADDRESSING not available?
-                // maybe add a way to allow interceptors to add stuff
to the
-                // context?
-            }
-           
-            context = JAXBContext.newInstance(classes.toArray(new
Class[classes.size()]));
-            contextMap.put(cls, context);
-        }
-        return context;
-    }
-
-    private static Class<?> getValidClass(Class<?> cls) {
-        if (cls.isEnum()) {
-            return cls;
-        }
-        if (cls.isArray()) {
-            return getValidClass(cls.getComponentType());
-        }
-
-        if (cls == Object.class || cls == String.class || cls ==
Holder.class) {
-            cls = null;
-        } else if (cls.isPrimitive()) {
-            return cls;
-        } else if (cls.isInterface() || cls.isAnnotation()) {
-            cls = null;
-        }
-        if (cls != null) {
-            try {
-                if (cls.getConstructor(new Class[0]) == null) {
-                    cls = null;
-                }
-            } catch (NoSuchMethodException ex) {
-                cls = null;
-            }
-        }
-        return cls;
+    private static Set<String> filter = new HashSet<String>();
+    
+    static {
+        filter.add("void");
+        filter.add("javax.activation.DataHandler");
     }
-
-    private static void addClass(Class<?> cls, Set<Class<?>> classes) {
-        if (cls.isArray()) {
-            // REVISIT-- add java primitive type array will cause jaxb
exception
-            //classes.add(cls);
-            return;
-        }
-        cls = getValidClass(cls);
-        if (null != cls) {
-            if (cls.isEnum()) {
-                // The object factory stuff doesn't work for enums
-                classes.add(cls);
-            }
-            String name = PackageUtils.getPackageName(cls) +
".ObjectFactory";
-            try {
-                cls = Class.forName(name, false, cls.getClassLoader());
-                if (cls != null) {
-                    classes.add(cls);
-                }
-            } catch (ClassNotFoundException ex) {
-                // cannot add factory, just add the class
-                classes.add(cls);
-            }
-        }
-    }
-
-    private static void addType(Type cls, Set<Class<?>> classes) {
-        if (cls instanceof Class) {
-            addClass((Class)cls, classes);
-        } else if (cls instanceof ParameterizedType) {
-            for (Type t2 :
((ParameterizedType)cls).getActualTypeArguments()) {
-                addType(t2, classes);
-            }
-        } else if (cls instanceof GenericArrayType) {
-            GenericArrayType gt = (GenericArrayType)cls;
-            Class ct = (Class) gt.getGenericComponentType();
-            ct = Array.newInstance(ct, 0).getClass();
-            //addType(ct, classes);
-            classes.add(ct);
-        }
-    }
-
-    // collect ALL the classes that are accessed by the class
-    private static void getClassesForContext(Class<?> theClass,
Set<Class<?>> classes, ClassLoader loader) {
-        Method methods[] = theClass.getMethods();
-        for (Method meth : methods) {
-            WebEndpoint webEndpoint =
meth.getAnnotation(WebEndpoint.class);
-            if (webEndpoint != null) {
-                getClassesForContext(meth.getReturnType(), classes,
loader);
-            }
-
-            // only methods marked as WebMethods are interesting to us
-            WebMethod webMethod = meth.getAnnotation(WebMethod.class);
-            if (webMethod == null) {
-                continue;
-            }
-
-            for (Type t : meth.getGenericParameterTypes()) {
-                addType(t, classes);
-            }
-            addType(meth.getGenericReturnType(), classes);
-
-            if (meth.getReturnType().isArray()) {
-                addClass(meth.getReturnType(), classes);
-            }
-            for (Class<?> cls : meth.getParameterTypes()) {
-                addClass(cls, classes);
-            }
-
-            for (Class<?> cls : meth.getExceptionTypes()) {
-                // addClass(cls, classes);
-                try {
-                    Method fim = cls.getMethod("getFaultInfo", new
Class[0]);
-                    addClass(fim.getReturnType(), classes);
-                } catch (NoSuchMethodException ex) {
-                    // ignore - not a valid JAXB fault thing
-                }
-            }
-            try {
-                // Get the RequestWrapper
-                RequestWrapper reqWrapper =
meth.getAnnotation(RequestWrapper.class);
-                if (reqWrapper != null) {
-                    Class<?> cls =
Class.forName(reqWrapper.className(), false, loader);
-                    addClass(cls, classes);
-
-                }
-                // Get the RequestWrapper
-
-                ResponseWrapper respWrapper =
meth.getAnnotation(ResponseWrapper.class);
-                if (respWrapper != null) {
-                    Class<?> cls =
Class.forName(respWrapper.className(), false, loader);
-                    addClass(cls, classes);
-                }
-            } catch (ClassNotFoundException ex) {
-                // ignore
-            }
-            // get ObjectFactory in case of bare
-
-            Annotation[][] parasAnnotation =
meth.getParameterAnnotations();
-            String packageName = null;
-            for (int i = 0; i < parasAnnotation.length; i++) {
-                Annotation[] paraAnno = parasAnnotation[i];
-                for (int j = 0; j < paraAnno.length; j++) {
-                    if (paraAnno[j].annotationType() == WebParam.class)
{
-                     
-                        packageName =
((WebParam)paraAnno[j]).targetNamespace();
-                        packageName =
PackageUtils.parsePackageName(packageName, null);
-
-                        try {
-                            Class<?> cls = Class.forName(packageName +
".ObjectFactory", false, theClass
-                                .getClassLoader());
-                            if (cls != null) {
-                                classes.add(cls);
-                            }
-                        } catch (ClassNotFoundException ex) {
-                            // ignore
-                        }
-                    }
-                }
-            }
-        }
-
-        for (Class<?> intf : theClass.getInterfaces()) {
-            getClassesForContext(intf, classes, loader);
-        }
-        if (theClass.getSuperclass() != null) {
-            getClassesForContext(theClass.getSuperclass(), classes,
loader);
-        }
+    
+    private JAXBEncoderDecoder() {
     }
 
     private static Marshaller createMarshaller(JAXBContext context,
Class<?> cls) throws JAXBException {
@@ -263,10 +81,26 @@
         return jm;
     }
 
-    public static void marshall(JAXBContext context, Schema schema,
Object elValue, QName elNname,
-                                Object source, AttachmentMarshaller am)
{
-
-        Class<?> cls = null != elValue ? elValue.getClass() : null;
+    public static void marshall(JAXBContext context, 
+                                Schema schema, 
+                                Object elValue, 
+                                MessagePartInfo part,
+                                Object source, 
+                                AttachmentMarshaller am) {
+        Class<?> cls = null;
+        if (part != null) {
+            cls = part.getTypeClass();
+        } 
+
+        if (cls == null) {
+            cls = null != elValue ? elValue.getClass() : null;
+        }
+        
+        if (cls != null && cls.isArray() && elValue instanceof
Collection) {
+            Collection<?> col = (Collection<?>) elValue;
+            elValue = col.toArray((Object[])
Array.newInstance(cls.getComponentType(), 0));
+        }
+        
         try {
             Marshaller u = createMarshaller(context, cls);
             try {
@@ -278,10 +112,16 @@
             }
             Object mObj = elValue;
 
-            if (null != elNname && null != cls &&
!cls.isAnnotationPresent(XmlRootElement.class)) {
+            QName elName = null;
+            if (part != null) {
+                elName = part.getConcreteName();
+            }
+            
+            if (null != elName &&
!cls.isAnnotationPresent(XmlRootElement.class)) {
                 mObj = JAXBElement.class.getConstructor(new Class[]
{QName.class, Class.class, Object.class})
-                    .newInstance(elNname, cls, mObj);
+                    .newInstance(elName, cls, mObj);
             }
+            
             u.setSchema(schema);
             if (am != null) {
                 u.setAttachmentMarshaller(am);
@@ -304,14 +144,19 @@
         marshall(context, schema, elValue, null, source, null);
     }
 
-    public static void marshall(JAXBContext context, Schema schema,
Object elValue, QName elNname,
+    public static void marshall(JAXBContext context, Schema schema, 
+                                Object elValue, 
+                                MessagePartInfo part,
                                 Object source) {
-        marshall(context, schema, elValue, elNname, source, null);
+        marshall(context, schema, elValue, part, source, null);
     }
 
     private static Unmarshaller createUnmarshaller(JAXBContext context,
Class<?> cls) throws JAXBException {
         Unmarshaller um = null;
         if (context == null) {
+            if (cls == null) {
+                throw new IllegalStateException("A JAXBContext or Class
to unmarshal must be provided!");
+            }
             context = JAXBContext.newInstance(cls);
         }
 
@@ -321,21 +166,32 @@
     }
 
     public static Object unmarshall(JAXBContext context, Schema schema,
Object source) {
-        return unmarshall(context, schema, source, null, null, null);
+        return unmarshall(context, schema, source, null, null);
     }
 
-    public static Object unmarshall(JAXBContext context, Schema schema,
Object source, QName elName) {
-        return unmarshall(context, schema, source, elName, null, null);
-    }
-
-    public static Object unmarshall(JAXBContext context, Schema schema,
Object source, QName elName,
-                                    Class<?> clazz) {
-        return unmarshall(context, schema, source, elName, clazz,
null);
-    }
-
-    public static Object unmarshall(JAXBContext context, Schema schema,
Object source, QName elName,
-                                    Class<?> clazz,
AttachmentUnmarshaller au) {
+    public static Object unmarshall(JAXBContext context, 
+                                    Schema schema, 
+                                    Object source,
+                                    MessagePartInfo part, 
+                                    AttachmentUnmarshaller au) {
+        Class<?> clazz = part != null ? (Class) part.getTypeClass() :
null;
+        QName elName = part != null ? part.getConcreteName() : null;
+
+        return unmarshall(context, schema, source, elName, clazz, au);
+    }
+    
+    public static Object unmarshall(JAXBContext context, 
+                                    Schema schema, 
+                                    Object source,
+                                    QName elName,
+                                    Class<?> clazz,
+                                    AttachmentUnmarshaller au) {
         Object obj = null;
+        
+        if (clazz != null && filter.contains(clazz.getName())) {
+            clazz = null;
+        }
+        
         try {
             Unmarshaller u = createUnmarshaller(context, clazz);
             u.setSchema(schema);
@@ -353,7 +209,6 @@
             } else {
                 throw new Fault(new Message("UNKNOWN_SOURCE", BUNDLE,
source.getClass().getName()));
             }
-       
         } catch (Exception ex) {
             if (ex instanceof javax.xml.bind.UnmarshalException) {
                 javax.xml.bind.UnmarshalException unmarshalEx =
(javax.xml.bind.UnmarshalException)ex;
@@ -363,10 +218,10 @@
                 throw new Fault(new Message("UNMARSHAL_ERROR", BUNDLE,
ex.getMessage()), ex);
             }
         }
-        return getElementValue(obj, elName);
+        return getElementValue(obj);
     }
 
-    public static Object getElementValue(Object obj, QName elName) {
+    public static Object getElementValue(Object obj) {
         if (null == obj) {
             return null;
         }
@@ -376,17 +231,7 @@
         }
         return obj;
     }
-
-//    private static boolean isSame(QName messageQName, QName
methodQName) {
-//        boolean same = false;
-//        if (StringUtils.isEmpty(messageQName.getNamespaceURI())) {
-//            same =
messageQName.getLocalPart().equals(methodQName.getLocalPart());
-//        } else {
-//            same = messageQName.equals(methodQName);
-//        }
-//        return same;
-//    }
-
+    
     public static Class<?> getClassFromType(Type t) {
         if (t instanceof Class) {
             return (Class)t;

Added:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src
/main/java/org/apache/cxf/jaxb/JAXBSchemaInitializer.java?view=auto&rev=
469066
========================================================================
======
---
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java (added)
+++
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java Sun Oct 29 20:56:21 2006
@@ -0,0 +1,84 @@
+/**
+ * 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.jaxb;
+
+import java.lang.reflect.Type;
+
+import javax.xml.namespace.QName;
+
+import
com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
+import com.sun.xml.bind.v2.model.core.Element;
+import com.sun.xml.bind.v2.model.core.NonElement;
+import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
+
+import org.apache.cxf.service.ServiceModelVisitor;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+
+/**
+ * Walks the service model and sets up the element/type names.
+ */
+class JAXBSchemaInitializer extends ServiceModelVisitor {
+
+    private XmlSchemaCollection schemas;
+
+    public JAXBSchemaInitializer(ServiceInfo serviceInfo,
XmlSchemaCollection col) {
+        super(serviceInfo);
+        schemas = col;
+    }
+
+    @Override
+    public void begin(MessagePartInfo part) {
+        // Check to see if the WSDL information has been filled in for
us.
+        if (part.getTypeQName() != null || part.getElementQName() !=
null) {
+            return;
+        }
+        
+        Class<?> clazz = part.getTypeClass();
+        if (clazz == null) {
+            return;
+        }
+        
+        RuntimeModelBuilder builder = new RuntimeModelBuilder(new
RuntimeInlineAnnotationReader(), null);
+        NonElement<Type, Class> typeInfo = builder.getTypeInfo(clazz,
null);
+
+        QName typeName = typeInfo.getTypeName();
+        // TODO: this doesn't seem to work with elements yet
+        if (typeName == null) {
+            return;
+        }
+
+        boolean isElement = typeInfo instanceof Element;
+        if (isElement) {
+            isElement = ((Element) typeInfo).getElementName() != null;
+        }
+
+        part.setElement(isElement);
+        if (isElement) {
+            QName name = ((Element) typeInfo).getElementName();
+            part.setElementQName(name);
+            part.setXmlSchema(schemas.getElementByQName(name));
+        } else {
+            part.setTypeQName(typeName);
+            part.setXmlSchema(schemas.getTypeByQName(typeName));
+        }
+    }
+}

Propchange:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java
------------------------------------------------------------------------
------
    svn:eol-style = native

Propchange:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java
------------------------------------------------------------------------
------
    svn:executable = *

Propchange:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/jax
b/JAXBSchemaInitializer.java
------------------------------------------------------------------------
------
    svn:keywords = Rev Date



Mime
View raw message