[jboss-svn-commits] JBossWS SVN: r1041 - in branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws: jbossxb xop

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Sep 25 10:27:46 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-09-25 10:27:41 -0400 (Mon, 25 Sep 2006)
New Revision: 1041

Removed:
   branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
   branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
Modified:
   branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java
   branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java
   branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java
Log:
clean MTOM implementation, remove all XB hacks

Modified: branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java	2006-09-25 14:26:07 UTC (rev 1040)
+++ branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/jbossxb/SchemaBindingBuilder.java	2006-09-25 14:27:41 UTC (rev 1041)
@@ -23,38 +23,31 @@
 
 // $Id$
 
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-
 import org.apache.xerces.xs.XSModel;
 import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.utils.JBossWSEntityResolver;
+import org.jboss.util.xml.JBossEntityResolver;
 import org.jboss.ws.Constants;
 import org.jboss.ws.WSException;
-import org.jboss.ws.xop.XOPValueAdapter;
+import org.jboss.ws.metadata.jaxrpcmapping.*;
+import org.jboss.ws.utils.JBossWSEntityResolver;
 import org.jboss.xb.binding.metadata.ClassMetaData;
 import org.jboss.xb.binding.metadata.PackageMetaData;
 import org.jboss.xb.binding.metadata.PropertyMetaData;
 import org.jboss.xb.binding.metadata.ValueMetaData;
 import org.jboss.xb.binding.sunday.unmarshalling.*;
 import org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler;
-import org.jboss.xb.binding.SimpleTypeBindings;
-import org.jboss.util.xml.JBossEntityResolver;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 import org.xml.sax.Attributes;
 
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import java.util.ArrayList;
+import java.util.Iterator;
+
 /**
  * Create SchemaBinding from XSModel and jaxrpc-mapping.
  *
@@ -297,21 +290,7 @@
 
          if (log.isTraceEnabled())
             log.trace("Bound element " + xmlName + " to property " + prop.getName());
-      }
-      // XOP elements that derive from xmlmime namespace
-      // need to be declared 'simple' in order for XB to
-      // treat them as simple base64Binaries.
-      QName elementType = element.getType().getQName();
-      if(elementType!=null)
-      {
-         String elementTypeNS = elementType.getNamespaceURI() != null ? elementType.getNamespaceURI() : "";
-         String elementTypeName = elementType.getLocalPart() != null ? elementType.getLocalPart() : "";
-         if(elementTypeNS.equals(Constants.NS_XML_MIME) && elementTypeName.equals("base64Binary"))
-         {
-            element.getType().setSimple(true);
-            //element.getType().setValueAdapter(new XOPValueAdapter());
-         }
-      }
+      }      
    }
 
    private void processWildcard(TypeBinding typeBinding, VariableMapping varMapping)

Deleted: branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-09-25 14:26:07 UTC (rev 1040)
+++ branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-09-25 14:27:41 UTC (rev 1041)
@@ -1,93 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.xop;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import javax.activation.DataSource;
-import org.jboss.xb.binding.JBossXBRuntimeException;
-
-/**
- * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
- * @version <tt>$Id$</tt>
- */
-public class SimpleDataSource
-   implements DataSource
-{
-   public final byte[] bytes;
-   public final String contentType;
-
-   public SimpleDataSource(Object o, String contentType)
-   {
-      ByteArrayOutputStream baos = new ByteArrayOutputStream();
-      ObjectOutputStream oos = null;
-      try
-      {
-         oos = new ObjectOutputStream(baos);
-         oos.writeObject(o);
-      }
-      catch(IOException e)
-      {
-         throw new JBossXBRuntimeException("XOP failed to serialize object " + o + ": " + e.getMessage());
-      }
-      finally
-      {
-         if(oos != null)
-         {
-            try
-            {
-               oos.close();
-            }
-            catch(IOException e)
-            {
-            }
-         }
-      }
-      bytes = baos.toByteArray();
-
-      this.contentType = contentType;
-   }
-
-   public String getContentType()
-   {
-      return contentType;
-   }
-
-   public InputStream getInputStream() throws IOException
-   {
-      return new ByteArrayInputStream(bytes);
-   }
-
-   public String getName()
-   {
-      throw new UnsupportedOperationException("getName is not implemented.");
-   }
-
-   public OutputStream getOutputStream() throws IOException
-   {
-      throw new UnsupportedOperationException("getOutputStream is not implemented.");
-   }
-}

Modified: branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java	2006-09-25 14:26:07 UTC (rev 1040)
+++ branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java	2006-09-25 14:27:41 UTC (rev 1041)
@@ -37,12 +37,10 @@
 import org.jboss.xb.binding.sunday.xop.XOPObject;
 
 import javax.activation.DataHandler;
-import javax.activation.DataSource;
 import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.SOAPElement;
 import javax.xml.soap.SOAPException;
-import javax.xml.soap.MimeHeader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Iterator;
@@ -299,16 +297,11 @@
       {
          dataHandler = new DataHandler(o, xopObject.getContentType());
       }
-      else if(! getContentTypeForClazz(o.getClass()).equals("application/octet-stream"))
+      else
       {
          dataHandler = new DataHandler(o, getContentTypeForClazz(o.getClass()));
       }
-      else
-      {
-         DataSource ds = new SimpleDataSource(o, "application/octet-stream");
-         dataHandler = new DataHandler(ds);
-      }
-
+      
       return dataHandler;
    }
 

Modified: branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java	2006-09-25 14:26:07 UTC (rev 1040)
+++ branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java	2006-09-25 14:27:41 UTC (rev 1041)
@@ -66,8 +66,7 @@
          AttachmentPart part = XOPContext.getAttachmentByCID(cid);
          Object content = part.getDataHandler().getContent();
 
-         // TODO: XB should actually be able to process any content
-         // that get's returned from calling the DataHandler
+         // TODO: XB should actually be able to process any content        
          if(content instanceof InputStream)
          {
             ByteArrayOutputStream bout = new ByteArrayOutputStream();

Deleted: branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
===================================================================
--- branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-09-25 14:26:07 UTC (rev 1040)
+++ branches/hbraun/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-09-25 14:27:41 UTC (rev 1041)
@@ -1,45 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.ws.xop;
-
-import org.jboss.xb.binding.sunday.unmarshalling.ValueAdapter;
-import org.jboss.xb.binding.sunday.xop.XOPObject;
-
-/**
- * @author Heiko Braun <heiko.braun at jboss.com>
- * @version $Id$
- * @since Aug 10, 2006
- */
-public class XOPValueAdapter implements ValueAdapter {
-   public Object cast(Object o, Class c) {
-
-      Object ret = o;
-
-      if(o!=null && XOPContext.isXOPPackage())
-      {
-         XOPObject xop = new XOPObject(o);
-         xop.setContentType(XOPContext.getContentTypeForClazz(c));
-         ret = XOPContext.createDataHandler(xop);
-      }
-      return ret;
-   }
-}




More information about the jboss-svn-commits mailing list