[jboss-svn-commits] JBossWS SVN: r1107 - branches/jbossws-1.0/src/main/java/org/jboss/ws/xop

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 2 06:56:02 EDT 2006


Author: heiko.braun at jboss.com
Date: 2006-10-02 06:55:54 -0400 (Mon, 02 Oct 2006)
New Revision: 1107

Added:
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/DisableMTOMHandler.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/RestoreXOPElementVisitor.java
Removed:
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
Modified:
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java
   branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java
Log:
MTOM revamp

Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/DisableMTOMHandler.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/DisableMTOMHandler.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/DisableMTOMHandler.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -0,0 +1,59 @@
+/*
+* 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.ws.jaxrpc.StubExt;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.MessageContext;
+
+/**
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Oct 2, 2006
+ */
+public class DisableMTOMHandler extends GenericHandler {
+   public QName[] getHeaders() {
+      return new QName[0];
+   }
+
+   public boolean handleRequest(MessageContext msgContext) {
+      disableMTOM(msgContext);
+      return true;
+   }
+
+   public boolean handleResponse(MessageContext msgContext) {
+      disableMTOM(msgContext);
+      return true;
+   }
+
+   public boolean handleFault(MessageContext msgContext) {
+      disableMTOM(msgContext);
+      return true;
+   }
+
+   public void disableMTOM(MessageContext msgContext)
+   {
+      msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+   }
+}


Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/DisableMTOMHandler.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/RestoreXOPElementVisitor.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/RestoreXOPElementVisitor.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/RestoreXOPElementVisitor.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -0,0 +1,73 @@
+/*
+* 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.ws.soap.SAAJVisitor;
+import org.jboss.ws.soap.SOAPContentElement;
+import org.jboss.ws.soap.SOAPElementImpl;
+
+import java.util.Iterator;
+
+/**
+ * Visit soap object model and restore XOP contents.
+ * This visitor is invoked when:
+ * <ul>
+ *    <li>Client side request handler chain has been executed
+ *    <li>Server side response or fault handler chain been executed
+ * </ul>
+ *
+ * It basically takes care that when jaxrpc handlers have been in place,
+ * the XOP contents are being restored upon request and response.
+ * 
+ * @author Heiko Braun <heiko.braun at jboss.com>
+ * @version $Id$
+ * @since Sep 26, 2006
+ */
+public class RestoreXOPElementVisitor implements SAAJVisitor {
+
+   public void visitXOPElements(SOAPElementImpl root)
+   {
+      boolean isSCE = (root instanceof SOAPContentElement);
+
+      // don't expand SOAPContentElements
+      if(isSCE)
+      {
+         root.accept(this);
+      }
+      else
+      {
+         Iterator it = root.getChildElements();
+         while(it.hasNext())
+         {
+            visitXOPElements((SOAPElementImpl)it.next());
+         }
+      }
+   }
+
+   public void visitSOAPElement(SOAPElementImpl soapElement) {
+      // nada
+   }
+
+   public void visitSOAPContentElement(SOAPContentElement scElement) {
+      scElement.handleMTOMTransitions();
+   }
+}


Property changes on: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/RestoreXOPElementVisitor.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Deleted: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/SimpleDataSource.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -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/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPContext.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -29,6 +29,7 @@
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.NameImpl;
 import org.jboss.ws.soap.SOAPMessageImpl;
+import org.jboss.ws.soap.SOAPElementImpl;
 import org.jboss.ws.utils.DOMUtils;
 import org.jboss.ws.utils.JavaUtils;
 import org.jboss.ws.utils.MimeUtils;
@@ -37,23 +38,22 @@
 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.SOAPBody;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.util.Iterator;
 
 /**
  * XOP context associated with a message context.
- * Acts as a facade to the current soap message and supports the various
- * XOP transitions.<p>
+ * Acts as a facade to the current soap message and supports the various XOP transitions.<p>
  * A good starting point to understand how MTOM in JBossWS works is to take a
  * look at the SOAPContentElement implementation.
  * 
- * @see org.jboss.ws.soap.SOAPContentElement
+ * @see org.jboss.ws.soap.SOAPContentElement#handleMTOMTransitions() 
  * @see XOPUnmarshallerImpl
  * @see XOPMarshallerImpl
  *
@@ -81,6 +81,32 @@
    }
 
    /**
+    * Check if the wire format is actually a xop encoded multipart message
+    */
+   public static boolean isMultipartXOP()
+   {
+      boolean isMultippartXOP = false;
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      if(msgContext!=null) {
+         SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
+         String[] contentType = soapMessage.getMimeHeaders().getHeader("content-type");
+         if(contentType!=null)
+         {
+            for(String value : contentType)
+            {
+               if(value.indexOf("application/xop+xml") != -1)
+               {
+                  isMultippartXOP = true;
+                  break;
+               }
+            }
+         }
+      }
+
+      return isMultippartXOP;
+   }
+
+   /**
     * Check if MTOM is disabled through a message context property.
     * (<code>org.jboss.ws.mtom.enabled</code>)<br>
     * Defaults to TRUE if the property is not set.
@@ -92,6 +118,12 @@
       return Boolean.TRUE.equals(mtomEnabled) || mtomEnabled == null;
    }
 
+   public static void setMTOMEnabled(boolean b)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.valueOf(b));
+   }
+
    /**
     * Replace all <code>xop:Include</code> elements with it's base64 representation.
     * This happens when the associated SOAPContentElement transitions to state dom-valid.<br>
@@ -129,12 +161,46 @@
    }
 
    /**
+    * When handlers jump in, the SOAPMessage flag that indicates
+    * a xop encoded message (derived from wire format) becomes stale.
+    *
+    * @param isXOPMessage
+    */
+   private static void setXOPMessage(boolean isXOPMessage)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      SOAPMessageImpl soapMsg = (SOAPMessageImpl)msgContext.getSOAPMessage();
+      soapMsg.setXOPMessage(isXOPMessage);
+   }
+
+   /**
+    * Visit the soap object model elements and restore xop data.
+    */
+   public static void visitAndRestoreXOPData()
+   {
+      try
+      {
+         if(!isXOPPackage() && isMTOMEnabled())
+         {
+            CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+            SOAPBody body = msgContext.getSOAPMessage().getSOAPBody();
+            RestoreXOPElementVisitor visitor = new RestoreXOPElementVisitor();
+            visitor.visitXOPElements((SOAPElementImpl)body);
+         }
+      }
+      catch (SOAPException e)
+      {
+         throw new WSException("Failed to restore XOP data", e);
+      }
+   }
+
+   /**
     * Restore previously inlined XOP elements.
     * All base64 representations will be replaced by <code>xop:Include</code>
     * elements and the attachment parts will be recreated. <br>
     * This happens when a SOAPContentElement is written to an output stream.
     */
-   public static void restoreXOPData(SOAPElement xopElement)
+   public static void restoreXOPDataDOM(SOAPElement xopElement)
    {
       String contentType = xopElement.getAttributeNS(NS_XOP_JBOSSWS, "content-type");
       if(contentType != null && contentType.length()>0)
@@ -148,7 +214,7 @@
          while(it.hasNext())
          {
             SOAPElement childElement = (SOAPElement)it.next();
-            restoreXOPData(childElement);
+            restoreXOPDataDOM(childElement);
          }
       }
    }
@@ -168,7 +234,7 @@
       xopObject.setContentType(contentType);
 
       XOPMarshaller xopMarshaller = new XOPMarshallerImpl();
-      String cid = xopMarshaller.addMtomAttachment(xopObject, xopElement.getNamespaceURI(), xopElement.getLocalName());      
+      String cid = xopMarshaller.addMtomAttachment(xopObject, xopElement.getNamespaceURI(), xopElement.getLocalName());
 
       // remove base64 node with the xop:Include element
       org.w3c.dom.Node child = (org.w3c.dom.Node)xopElement.getFirstChild();
@@ -178,7 +244,7 @@
       {
          SOAPElement xopInclude = xopElement.addChildElement(Constants.NAME_XOP_INCLUDE);
          xopInclude.setAttribute("href", cid);
-         log.debug("Restored xop:Include element on {" + xopElement.getNamespaceURI()+"}"+xopElement.getLocalName());
+         log.debug("Restored xop:Include element on [xmlName="+xopElement.getLocalName()+"]");
       }
       catch (SOAPException e)
       {
@@ -222,7 +288,7 @@
       log.debug("Created base64 representation for content-type " + contentType);
 
       // cleanup the attachment part
-      CommonMessageContext msgContext = (CommonMessageContext)MessageContextAssociation.peekMessageContext();
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
       SOAPMessageImpl soapMessage = (SOAPMessageImpl)msgContext.getSOAPMessage();
 
       if(cid.startsWith("cid:")) cid = cid.substring(4);
@@ -234,6 +300,11 @@
 
       log.debug("Removed attachment part " + cid);
 
+      // leave soap object model in a valid state
+      setXOPMessage(false);
+
+      //log.warn("Further MTOM processing disabled. The XOP encoding will not be restored.");
+      //setMTOMEnabled(false);
    }
 
    /**
@@ -272,15 +343,10 @@
       {
          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/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPMarshallerImpl.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -29,6 +29,8 @@
 import org.jboss.ws.soap.attachment.MimeConstants;
 import org.jboss.ws.soap.attachment.ContentHandlerRegistry;
 import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.utils.IOUtils;
+import org.jboss.ws.WSException;
 import org.jboss.xb.binding.sunday.xop.XOPMarshaller;
 import org.jboss.xb.binding.sunday.xop.XOPObject;
 

Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPScanner.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -49,19 +49,26 @@
 
    // avoid circular scans
    private List<String> scannedItems = new ArrayList<String>();
+   private static final String BASE64_BINARY = "base64Binary";
 
    /**
     * Query a complex type for nested XOP type definitions.
     */
    public XSTypeDefinition findXOPTypeDef(XSTypeDefinition typeDef)
-   {
+   {      
+      if(typeDef==null)
+         return typeDef;
       XSTypeDefinition result = null;
+      String name = typeDef.getName();
+      String namespace = typeDef.getNamespace()!=null ? typeDef.getNamespace():"";
 
-      if(typeDef instanceof XSComplexTypeDefinition)
+      if(typeDef instanceof XSSimpleTypeDefinition && BASE64_BINARY.equals(name))
       {
+         return typeDef;
+      }
+      else if(typeDef instanceof XSComplexTypeDefinition)
+      {
          XSComplexTypeDefinition complexTypeDef = (XSComplexTypeDefinition)typeDef;
-         String name = complexTypeDef.getName();
-         String namespace = complexTypeDef.getNamespace()!=null ? complexTypeDef.getNamespace():"";
          if(name!=null)
          {
             String typeKey = namespace+":"+name;
@@ -81,7 +88,7 @@
          if (complexTypeDef.getSimpleType() != null)
          {
             String typeName = complexTypeDef.getSimpleType().getName();
-            if ("base64Binary".equals(typeName))
+            if (BASE64_BINARY.equals(typeName))
                return complexTypeDef;
          }
          else

Modified: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPUnmarshallerImpl.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -32,6 +32,7 @@
 import javax.xml.soap.SOAPException;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 
 /**
  * The XOPUnmarshallerImpl allows callbacks from the binding layer towards the
@@ -62,18 +63,34 @@
    {
       try
       {
-         // Always return the DataHandler, it's the preferred SEI parameter type.
-         // If necessary the conversion can take just place in SOAPContentElement
          AttachmentPart part = XOPContext.getAttachmentByCID(cid);
-         XOPObject xopObject = new XOPObject(part.getDataHandler());
+         Object content = part.getDataHandler().getContent();
+
+         // TODO: XB should actually be able to process any content        
+         if(content instanceof InputStream)
+         {
+            ByteArrayOutputStream bout = new ByteArrayOutputStream();
+            part.getDataHandler().writeTo(bout);
+            content = bout.toByteArray();
+         }
+         else
+         {
+            throw new WSException("Unsupported content type " + content);
+         }
+
+         XOPObject xopObject = new XOPObject(content);
          xopObject.setContentType(part.getDataHandler().getContentType());
 
          return xopObject;
       }
-      catch (SOAPException ex)
+      catch(SOAPException e)
       {
-         throw new WSException(ex);
+         throw new WSException("Failed to access attachment part", e);
       }
+      catch(IOException e)
+      {
+         throw new WSException("Failed to extract attachment data", e);
+      }
    }
 
    public byte[] getAttachmentAsByteArray(String cid)

Deleted: branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java
===================================================================
--- branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-10-02 10:55:05 UTC (rev 1106)
+++ branches/jbossws-1.0/src/main/java/org/jboss/ws/xop/XOPValueAdapter.java	2006-10-02 10:55:54 UTC (rev 1107)
@@ -1,39 +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) {
-
-      XOPObject xop = new XOPObject(o);
-      xop.setContentType(XOPContext.getContentTypeForClazz(c));      
-      return XOPContext.createDataHandler(xop);
-   }
-}




More information about the jboss-svn-commits mailing list