axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Veithen <andreas.veit...@gmail.com>
Subject Re: svn commit: r952971 - in /axis/axis2/java/core/trunk/modules: jaxws/src/org/apache/axis2/jaxws/message/impl/ jaxws/test/org/apache/axis2/jaxws/message/impl/ kernel/src/org/apache/axis2/util/
Date Wed, 09 Jun 2010 17:28:54 GMT
Rich,

I was going to do an attempt to fix the issue we have with Hudson when
several Axis2 related jobs run in parallel. For this I need a stable
build. Therefore, I'm going to temporarily revert the change. Remember
that you can easily reapply it using "svn -c 952971 . ." later.

Andreas

On Wed, Jun 9, 2010 at 18:07, R J Scheuerle Jr <scheu@us.ibm.com> wrote:
> Thanks Andreas,
>
> Phil is going to reopen the JIRA and change the WrappedDataHandler to avoid
> the null DataSource issue.
>
> Rich Scheuerle
> Senior Programmer, AIM SWG
> IBM Web Services (JAX-RPC, JAX-WS, SAAJ)
> Development, Customer Solutions, and Open Source
> Apache Axis2 (scheu@apache.org)
> 512-286-8420 (IBM TL 363-8420)
>
> Andreas Veithen <andreas.veithen@gmail.com> wrote on 06/09/2010 10:12:16 AM:
>
>> Andreas Veithen <andreas.veithen@gmail.com>
>> 06/09/2010 10:12 AM
>>
>> Please respond to
>> java-dev@axis.apache.org
>>
>> To
>>
>> java-dev@axis.apache.org
>>
>> cc
>>
>> Subject
>>
>> Re: svn commit: r952971 - in /axis/axis2/java/core/trunk/modules:
>> jaxws/src/org/apache/axis2/jaxws/message/impl/ jaxws/test/org/
>> apache/axis2/jaxws/message/impl/  kernel/src/org/apache/axis2/util/
>
>>
>> Rich,
>>
>> I think this change causes the Hudson build to fail, because passing
>> null as DataSource argument to DataHandler is not allowed. Probably
>> this depends on the particular JAF implementation that is used. Can
>> you make sure that the DataHandler wrapper works with both the Sun and
>> the Geronimo implementation?
>>
>> Andreas
>>
>> On Wed, Jun 9, 2010 at 14:02,  <scheu@apache.org> wrote:
>> > Author: scheu
>> > Date: Wed Jun  9 12:02:06 2010
>> > New Revision: 952971
>> >
>> > URL: http://svn.apache.org/viewvc?rev=952971&view=rev
>> > Log:
>> > AXIS2-4733
>> > Contributor: Phil Adams
>> > Contributed WrappedDataHandler to allow Axis2 to set the
>> appropriate content-type on a DataHandler.
>> > Also added a validation test.
>> >
>> > Added:
>> >    axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/
>> jaxws/message/impl/WrappedDataHandlerTest.java
>> >    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/
>> util/WrappedDataHandler.java
>> > Modified:
>> >    axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/
>> jaxws/message/impl/MessageFactoryImpl.java
>> >
>> > Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/
>> axis2/jaxws/message/impl/MessageFactoryImpl.java
>> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/
>> modules/jaxws/src/org/apache/axis2/jaxws/message/impl/
>> MessageFactoryImpl.java?rev=952971&r1=952970&r2=952971&view=diff
>> >
>>
>> ==============================================================================
>> > --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/
>> jaxws/message/impl/MessageFactoryImpl.java (original)
>> > +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/
>> jaxws/message/impl/MessageFactoryImpl.java Wed Jun  9 12:02:06 2010
>> > @@ -37,6 +37,7 @@ import org.apache.axis2.jaxws.message.da
>> >  import org.apache.axis2.jaxws.message.databinding.DataSourceBlock;
>> >  import org.apache.axis2.jaxws.message.factory.MessageFactory;
>> >  import org.apache.axis2.transport.http.HTTPConstants;
>> > +import org.apache.axis2.util.WrappedDataHandler;
>> >
>> >  import javax.xml.soap.AttachmentPart;
>> >  import javax.xml.soap.MimeHeader;
>> > @@ -118,7 +119,7 @@ public class MessageFactoryImpl implemen
>> >                 m.setDoingSWA(true);
>> >                 while (it.hasNext()) {
>> >                     AttachmentPart ap = (AttachmentPart)it.next();
>> > -                    m.addDataHandler(ap.getDataHandler(),
>> ap.getContentId());
>> > +                    m.addDataHandler(new WrappedDataHandler
>> (ap.getDataHandler(), ap.getContentType()), ap.getContentId());
>> >                 }
>> >             }
>> >             return m;
>> > @@ -144,5 +145,4 @@ public class MessageFactoryImpl implemen
>> >         }
>> >         return createFrom(block.getXMLStreamReader(true), protocol);
>> >     }
>> > -
>> >  }
>> >
>> > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/
>> axis2/jaxws/message/impl/WrappedDataHandlerTest.java
>> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/
>> modules/jaxws/test/org/apache/axis2/jaxws/message/impl/
>> WrappedDataHandlerTest.java?rev=952971&view=auto
>> >
>>
>> ==============================================================================
>> > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/
>> axis2/jaxws/message/impl/WrappedDataHandlerTest.java (added)
>> > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/
>> axis2/jaxws/message/impl/WrappedDataHandlerTest.java Wed Jun  9 12:02:06
>> 2010
>> > @@ -0,0 +1,48 @@
>> > +package org.apache.axis2.jaxws.message.impl;
>> > +
>> > +/*
>> > + * 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.
>> > + */
>> > +
>> > +import java.net.URL;
>> > +import javax.activation.DataHandler;
>> > +
>> > +import org.apache.axis2.util.WrappedDataHandler;
>> > +
>> > +import junit.framework.TestCase;
>> > +
>> > +/**
>> > + * Test the WrappedDataHandler class.
>> > + */
>> > +public class WrappedDataHandlerTest extends TestCase {
>> > +
>> > +   /**
>> > +    * Verify that the Wrapped DataHandler maintains the correct
>> content-type value
>> > +    * for an XML document attachment.
>> > +    */
>> > +   public void testWrappedDataHandler() throws Exception {
>> > +      URL xmlAttachment = new URL("file:./test-resources/xml/
>> soapmessage.xml");
>> > +
>> > +      DataHandler dh = new DataHandler(xmlAttachment);
>> > +      assertTrue(dh.getContentType().equals("application/xml"));
>> > +
>> > +      WrappedDataHandler wrappedDH = new WrappedDataHandler(dh,
>> "text/xml");
>> > +      assertTrue(wrappedDH.getContentType() != null);
>> > +      assertTrue(wrappedDH.getContentType().equals("text/xml"));
>> > +   }
>> > +}
>> >
>> > Added: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/
>> axis2/util/WrappedDataHandler.java
>> > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/
>> modules/kernel/src/org/apache/axis2/util/WrappedDataHandler.java?
>> rev=952971&view=auto
>> >
>>
>> ==============================================================================
>> > --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/
>> axis2/util/WrappedDataHandler.java (added)
>> > +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/
>> axis2/util/WrappedDataHandler.java Wed Jun  9 12:02:06 2010
>> > @@ -0,0 +1,185 @@
>> > +/*
>> > + * 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.axis2.util;
>> > +
>> > +import java.awt.datatransfer.DataFlavor;
>> > +import java.awt.datatransfer.UnsupportedFlavorException;
>> > +import java.io.IOException;
>> > +import java.io.InputStream;
>> > +import java.io.OutputStream;
>> > +
>> > +import javax.activation.CommandInfo;
>> > +import javax.activation.CommandMap;
>> > +import javax.activation.DataHandler;
>> > +import javax.activation.DataSource;
>> > +
>> > +import org.apache.commons.logging.Log;
>> > +import org.apache.commons.logging.LogFactory;
>> > +
>> > +/**
>> > + * This class acts as a wrapper for the javax.activation.DataHandler
>> > class.
>> > + * It is used to store away a (potentially) user-defined content-
>> type value along with
>> > + * the DataHandler instance.   We'll delegate all method calls
>> except for getContentType()
>> > + * to the delegate DataHandler instance passed into the ctor.
>> > + */
>> > +public class WrappedDataHandler extends DataHandler {
>> > +
>> > +    private static final Log log = LogFactory.getLog
>> (WrappedDataHandler.class);
>> > +
>> > +    DataHandler delegate;
>> > +    String contentType;
>> > +
>> > +    /**
>> > +     * Constructs a new instance of the WrappedDataHandler.
>> > +     * @param _delegate the real DataHandler instance being wrapped
>> > +     * @param _contentType the user-defined contentType
>> associated with the DataHandler instance
>> > +     */
>> > +    public WrappedDataHandler(DataHandler _delegate, String
>> > _contentType) {
>> > +        super((DataSource)null);
>> > +
>> > +        delegate = _delegate;
>> > +        contentType = _contentType;
>> > +
>> > +        if (log.isDebugEnabled()) {
>> > +            log.debug("Created instance of WrappedDatahandler: "
>> + this.toString() + ", contentType=" + contentType
>> > +                + "\nDelegate DataHandler: " + delegate.toString());
>> > +        }
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getAllCommands()
>> > +     */
>> > +    @Override
>> > +    public CommandInfo[] getAllCommands() {
>> > +        return delegate.getAllCommands();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getBean
>> (javax.activation.CommandInfo)
>> > +     */
>> > +    @Override
>> > +    public Object getBean(CommandInfo paramCommandInfo) {
>> > +        return delegate.getBean(paramCommandInfo);
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getCommand(java.lang.String)
>> > +     */
>> > +    @Override
>> > +    public CommandInfo getCommand(String paramString) {
>> > +        return delegate.getCommand(paramString);
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getContent()
>> > +     */
>> > +    @Override
>> > +    public Object getContent() throws IOException {
>> > +        return delegate.getContent();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getContentType()
>> > +     */
>> > +    @Override
>> > +    public String getContentType() {
>> > +        return (contentType != null ? contentType :
>> delegate.getContentType());
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getDataSource()
>> > +     */
>> > +    @Override
>> > +    public DataSource getDataSource() {
>> > +        return delegate.getDataSource();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getInputStream()
>> > +     */
>> > +    @Override
>> > +    public InputStream getInputStream() throws IOException {
>> > +        return delegate.getInputStream();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getName()
>> > +     */
>> > +    @Override
>> > +    public String getName() {
>> > +        return delegate.getName();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getOutputStream()
>> > +     */
>> > +    @Override
>> > +    public OutputStream getOutputStream() throws IOException {
>> > +        return delegate.getOutputStream();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getPreferredCommands()
>> > +     */
>> > +    @Override
>> > +    public CommandInfo[] getPreferredCommands() {
>> > +        return delegate.getPreferredCommands();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getTransferData
>> (java.awt.datatransfer.DataFlavor)
>> > +     */
>> > +    @Override
>> > +    public Object getTransferData(DataFlavor paramDataFlavor)
>> throws UnsupportedFlavorException, IOException {
>> > +        return delegate.getTransferData(paramDataFlavor);
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#getTransferDataFlavors()
>> > +     */
>> > +    @Override
>> > +    public synchronized DataFlavor[] getTransferDataFlavors() {
>> > +        return delegate.getTransferDataFlavors();
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#isDataFlavorSupported
>> (java.awt.datatransfer.DataFlavor)
>> > +     */
>> > +    @Override
>> > +    public boolean isDataFlavorSupported(DataFlavor paramDataFlavor) {
>> > +        return delegate.isDataFlavorSupported(paramDataFlavor);
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#setCommandMap
>> (javax.activation.CommandMap)
>> > +     */
>> > +    @Override
>> > +    public synchronized void setCommandMap(CommandMap paramCommandMap)
>> > {
>> > +        delegate.setCommandMap(paramCommandMap);
>> > +    }
>> > +
>> > +    /* (non-Javadoc)
>> > +     * @see javax.activation.DataHandler#writeTo(java.io.OutputStream)
>> > +     */
>> > +    @Override
>> > +    public void writeTo(OutputStream paramOutputStream) throws
>> IOException {
>> > +        delegate.writeTo(paramOutputStream);
>> > +    }
>> > +}
>> >
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
>> For additional commands, e-mail: java-dev-help@axis.apache.org
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message