Coverage Report - axis.dynamic.SoapInterface
 
Classes in this File Line Coverage Branch Coverage Complexity
SoapInterface
0%
0/27
0%
0/10
0
 
 1  
 /*
 2  
 Copyright (c) 2006, University of Tromsø
 3  
 All rights reserved.
 4  
 
 5  
 Redistribution and use in source and binary forms, with or without 
 6  
 modification, are permitted provided that the following conditions are met:
 7  
 
 8  
  * Redistributions of source code must retain the above copyright notice, this list 
 9  
    of conditions and the following disclaimer.
 10  
 
 11  
  * Redistributions in binary form must reproduce the above copyright notice, this 
 12  
    list of conditions and the following disclaimer in the documentation and/or other 
 13  
    materials provided with the distribution.
 14  
 
 15  
  * Neither the name of the University of Tromsø nor the names of its contributors may 
 16  
    be used to endorse or promote products derived from this software without specific 
 17  
    prior written permission.
 18  
 
 19  
 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 20  
 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 
 21  
 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT 
 22  
 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 23  
 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 24  
 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
 25  
 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 26  
 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 
 27  
 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
 28  
 DAMAGE.
 29  
 */
 30  
 
 31  
 package axis.dynamic;
 32  
 
 33  
 import java.util.ArrayList;
 34  
 import java.util.HashMap;
 35  
 import java.util.List;
 36  
 import java.util.Map;
 37  
 
 38  
 import org.apache.axis.AxisEngine;
 39  
 import org.apache.axis.Chain;
 40  
 import org.apache.axis.Handler;
 41  
 import org.apache.axis.SimpleChain;
 42  
 import org.apache.axis.constants.Style;
 43  
 import org.apache.axis.constants.Use;
 44  
 
 45  
 /**
 46  
  * base class for soap senders and receivers.
 47  
  * 
 48  
  * TODO: refactor code that this class has in common with SoapConfiguration.
 49  
  */
 50  0
 public abstract class SoapInterface
 51  
 {
 52  
   private List<Handler> _requestHandlers;
 53  
   
 54  
   private List<Handler> _responseHandlers;
 55  
   
 56  0
   protected Map<String, Object> _properties = new HashMap<String, Object>();
 57  
   
 58  
   public abstract void setStyle( Style style );
 59  
 
 60  
   public abstract void setUse( Use use );
 61  
 
 62  
   
 63  
   public void setSendMultiRefs( boolean multiRefs )
 64  
   {
 65  0
     setProperty(AxisEngine.PROP_DOMULTIREFS, Boolean.valueOf(multiRefs));
 66  0
   }
 67  
   
 68  
   public void setSendXsiTypes( boolean xsiTypes )
 69  
   {
 70  0
     setProperty(AxisEngine.PROP_SEND_XSI, Boolean.valueOf(xsiTypes));
 71  0
   }
 72  
   
 73  
   public void setUsePrettyXml( boolean pretty )
 74  
   {
 75  0
     setProperty(AxisEngine.PROP_DISABLE_PRETTY_XML, Boolean.valueOf(! pretty));
 76  0
   }
 77  
   
 78  
   /*
 79  
   public void setSendXmlDeclaration( boolean sendXmlDeclaration )
 80  
   {
 81  
     setProperty(AxisEngine.PROP_XML_DECL, Boolean.valueOf(sendXmlDeclaration));
 82  
   }
 83  
   */
 84  
   
 85  
   /*
 86  
   public void setDotNetSoapEncFix( boolean dotNetSoapEncFix )
 87  
   {
 88  
     setProperty(AxisEngine.PROP_DOTNET_SOAPENC_FIX, Boolean.valueOf(dotNetSoapEncFix));
 89  
   }
 90  
   */
 91  
   
 92  
   protected void setProperty( String name, Object value )
 93  
   {
 94  0
     _properties.put(name, value);
 95  0
   }
 96  
 
 97  
   public void setRequestHandlers( List<Handler> handlers )
 98  
   {
 99  0
     _requestHandlers = handlers;
 100  0
   }
 101  
 
 102  
   public void addRequestHandler( Handler handler )
 103  
   {
 104  0
     if (_requestHandlers == null) _requestHandlers = new ArrayList<Handler>();
 105  0
     _requestHandlers.add(handler);
 106  0
   }
 107  
 
 108  
   public void setResponseHandlers( List<Handler> handlers )
 109  
   {
 110  0
     _responseHandlers = handlers;
 111  0
   }
 112  
 
 113  
   public void addResponseHandler( Handler handler )
 114  
   {
 115  0
     if (_responseHandlers == null) _responseHandlers = new ArrayList<Handler>();
 116  0
     _responseHandlers.add(handler);
 117  0
   }
 118  
   
 119  
   /**
 120  
    * @return may be null
 121  
    */
 122  
   protected Chain getRequestChain()
 123  
   {
 124  0
     return getChain(_requestHandlers);
 125  
   }
 126  
 
 127  
   /**
 128  
    * @return may be null
 129  
    */
 130  
   protected Chain getResponseChain()
 131  
   {
 132  0
     return getChain(_responseHandlers);
 133  
   }
 134  
 
 135  
   /**
 136  
    * @param handlers 
 137  
    * @return null if given list is null
 138  
    */
 139  
   private Chain getChain( List<Handler> handlers )
 140  
   {
 141  0
     if (handlers == null) return null;
 142  
     
 143  0
     SimpleChain chain = new SimpleChain();
 144  0
     for (Handler handler : handlers)
 145  
     {
 146  0
       chain.addHandler(handler);
 147  
     }
 148  0
     return chain;
 149  
   }
 150  
   
 151  
 }