Coverage Report - org.mule.module.cxf.support.ProxyServiceFactoryBean
 
Classes in this File Line Coverage Branch Coverage Complexity
ProxyServiceFactoryBean
0%
0/33
0%
0/14
0
 
 1  
 /*
 2  
  * $Id: ProxyServiceFactoryBean.java 19230 2010-08-26 21:02:04Z mike.schilling $
 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.support;
 12  
 
 13  
 import java.lang.reflect.Method;
 14  
 import java.util.ArrayList;
 15  
 import java.util.List;
 16  
 import java.util.logging.Level;
 17  
 import java.util.logging.Logger;
 18  
 
 19  
 import javax.xml.namespace.QName;
 20  
 import javax.xml.transform.Source;
 21  
 
 22  
 import org.apache.cxf.common.logging.LogUtils;
 23  
 import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 24  
 import org.apache.cxf.service.factory.ServiceConstructionException;
 25  
 import org.apache.cxf.service.model.EndpointInfo;
 26  
 import org.apache.cxf.service.model.OperationInfo;
 27  
 import org.apache.cxf.service.model.ServiceInfo;
 28  
 import org.mule.module.cxf.i18n.CxfMessages;
 29  
 
 30  
 public class ProxyServiceFactoryBean extends ReflectionServiceFactoryBean
 31  
 {
 32  
 
 33  0
     private static final Logger LOG = LogUtils.getLogger(ProxyServiceFactoryBean.class);
 34  
 
 35  
     public ProxyServiceFactoryBean()
 36  0
     {
 37  0
         getServiceConfigurations().add(0, new ProxyServiceConfiguration());
 38  
 
 39  0
         List<String> ignoredClasses = new ArrayList<String>();
 40  0
         ignoredClasses.add("java.lang.Object");
 41  0
         ignoredClasses.add("java.lang.Throwable");
 42  0
         ignoredClasses.add("org.omg.CORBA_2_3.portable.ObjectImpl");
 43  0
         ignoredClasses.add("org.omg.CORBA.portable.ObjectImpl");
 44  0
         ignoredClasses.add("javax.ejb.EJBObject");
 45  0
         ignoredClasses.add("javax.rmi.CORBA.Stub");
 46  0
         setIgnoredClasses(ignoredClasses);
 47  0
     }
 48  
     
 49  
     @Override
 50  
     protected void initializeWSDLOperations()
 51  
     {
 52  0
         if (getServiceClass().isAssignableFrom(ProxyService.class))
 53  
         {
 54  0
             initializeWSDLOperationsForProvider();
 55  
         }
 56  
         else
 57  
         {
 58  0
             super.initializeWSDLOperations();
 59  
         }
 60  0
     }
 61  
 
 62  
     protected void initializeWSDLOperationsForProvider()
 63  
     {
 64  0
         Class c = Source.class;
 65  
 
 66  0
         if (getEndpointInfo() == null && isFromWsdl())
 67  
         {
 68  
             // most likely, they specified a WSDL, but for some reason
 69  
             // did not give a valid ServiceName/PortName. For provider,
 70  
             // we'll allow this since everything is bound directly to
 71  
             // the invoke method, however, this CAN cause other problems
 72  
             // such as addresses in the wsdl not getting updated and such
 73  
             // so we'll WARN about it.....
 74  0
             List<QName> enames = new ArrayList<QName>();
 75  0
             for (ServiceInfo si : getService().getServiceInfos())
 76  
             {
 77  0
                 for (EndpointInfo ep : si.getEndpoints())
 78  
                 {
 79  0
                     enames.add(ep.getName());
 80  
                 }
 81  
             }
 82  0
             LOG.log(Level.WARNING, "COULD_NOT_FIND_ENDPOINT",  new ComponentNotFoundRuntimeException(
 83  
                 CxfMessages.couldNotFindEndpoint(getEndpointName(), enames)));
 84  
         }
 85  
 
 86  
         try
 87  
         {
 88  0
             Method invoke = getServiceClass().getMethod("invoke", c);
 89  
 
 90  
             // Bind every operation to the invoke method.
 91  0
             for (ServiceInfo si : getService().getServiceInfos())
 92  
             {
 93  0
                 for (OperationInfo o : si.getInterface().getOperations())
 94  
                 {
 95  0
                     getMethodDispatcher().bind(o, invoke);
 96  
                 }
 97  
             }
 98  
         }
 99  0
         catch (SecurityException e)
 100  
         {
 101  0
             throw new ServiceConstructionException(e);
 102  
         }
 103  0
         catch (NoSuchMethodException e)
 104  
         {
 105  0
             throw new ServiceConstructionException(e);
 106  0
         }
 107  
 
 108  0
     }
 109  
 
 110  
 }