Coverage Report - org.mule.module.cxf.transport.MuleUniversalDestination
 
Classes in this File Line Coverage Branch Coverage Complexity
MuleUniversalDestination
0%
0/10
N/A
0
MuleUniversalDestination$ResponseConduit
0%
0/10
N/A
0
 
 1  
 /*
 2  
  * $Id: MuleUniversalDestination.java 20372 2010-11-28 18:49:05Z dandiep $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.module.cxf.transport;
 12  
 
 13  
 import org.mule.module.cxf.support.DelegatingOutputStream;
 14  
 
 15  
 import java.io.ByteArrayOutputStream;
 16  
 import java.io.IOException;
 17  
 import java.io.OutputStream;
 18  
 import java.util.logging.Logger;
 19  
 
 20  
 import org.apache.cxf.message.Message;
 21  
 import org.apache.cxf.service.model.EndpointInfo;
 22  
 import org.apache.cxf.transport.AbstractConduit;
 23  
 import org.apache.cxf.transport.AbstractDestination;
 24  
 import org.apache.cxf.transport.Conduit;
 25  
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 26  
 
 27  0
 public class MuleUniversalDestination extends AbstractDestination
 28  
 {
 29  
     public static final String RESPONSE_OBSERVER = "mule.destination.response.observer";
 30  
 
 31  0
     private static final Logger LOGGER = Logger.getLogger(MuleUniversalDestination.class.getName());
 32  
     private MuleUniversalTransport transport;
 33  
 
 34  
     public MuleUniversalDestination(MuleUniversalTransport transport,
 35  
                                     EndpointReferenceType ref,
 36  
                                     EndpointInfo ei)
 37  
     {
 38  0
         super(ref, ei); 
 39  0
         this.transport = transport;
 40  0
     }
 41  
 
 42  
     @Override
 43  
     protected Conduit getInbuiltBackChannel(Message inMessage)
 44  
     {
 45  0
         return new ResponseConduit(null);
 46  
     }
 47  
 
 48  
     @Override
 49  
     protected Logger getLogger()
 50  
     {
 51  0
         return LOGGER;
 52  
     }
 53  
 
 54  
     @Override
 55  
     public void shutdown()
 56  
     {
 57  0
         transport.remove(this);
 58  
 
 59  0
         super.shutdown();
 60  0
     }
 61  
 
 62  
     public class ResponseConduit extends AbstractConduit
 63  
     {
 64  
 
 65  
         public ResponseConduit(EndpointReferenceType arg0)
 66  0
         {
 67  0
             super(arg0);
 68  0
         }
 69  
 
 70  
         public void prepare(Message message) throws IOException {
 71  
             // set an outputstream which will be used for things like attachment headers.
 72  
             // we'll stream the body later on down the line via the OutputHandler in CxfServiceComponent
 73  0
             DelegatingOutputStream stream = new DelegatingOutputStream(new ByteArrayOutputStream());
 74  0
             message.setContent(OutputStream.class, stream);
 75  0
             message.setContent(DelegatingOutputStream.class, stream);
 76  0
         }
 77  
 
 78  
         @Override
 79  
         public void close(Message message) throws IOException
 80  
         {
 81  0
             message.getContent(OutputStream.class).close();
 82  0
         }
 83  
 
 84  
         @Override
 85  
         protected Logger getLogger()
 86  
         {
 87  0
             return LOGGER;
 88  
         }
 89  
 
 90  
     }
 91  
 }