Coverage Report - org.mule.transport.ejb.EjbConnector
 
Classes in this File Line Coverage Branch Coverage Complexity
EjbConnector
78%
7/9
N/A
2
 
 1  
 /*
 2  
  * $Id: EjbConnector.java 10489 2008-01-23 17:53:38Z dfeist $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.transport.ejb;
 12  
 
 13  
 import org.mule.api.endpoint.ImmutableEndpoint;
 14  
 import org.mule.transport.rmi.RmiConnector;
 15  
 import org.mule.util.ClassUtils;
 16  
 
 17  
 import java.lang.reflect.Method;
 18  
 import java.net.UnknownHostException;
 19  
 import java.rmi.Remote;
 20  
 import java.rmi.RemoteException;
 21  
 
 22  
 import javax.ejb.EJBObject;
 23  
 
 24  
 /**
 25  
  * Provides Connection configurstion for EJB endpoints
 26  
  */
 27  
 
 28  40
 public class EjbConnector extends RmiConnector
 29  
 {
 30  
     public static final String EJB = "ejb";
 31  
 
 32  
     // Errorcodes
 33  
     public static final int EJB_SERVICECLASS_INVOCATION_FAILED = 2;
 34  
 
 35  
     public String getProtocol()
 36  
     {
 37  96
         return EJB;
 38  
     }
 39  
 
 40  
     public Remote getRemoteObject(ImmutableEndpoint endpoint) throws RemoteException, UnknownHostException
 41  
     {
 42  
         EJBObject remoteObj;
 43  
 
 44  
         try
 45  
         {
 46  12
             Object ref = getRemoteRef(endpoint);
 47  
 
 48  12
             Method method = ClassUtils.getMethod(ref.getClass(), "create", null);
 49  
 
 50  12
             remoteObj = (EJBObject)method.invoke(ref, ClassUtils.NO_ARGS);
 51  
         }
 52  0
         catch (Exception e)
 53  
         {
 54  0
             throw new RemoteException("Remote EJBObject lookup failed for '" + endpoint.getEndpointURI(), e);
 55  12
         }
 56  
 
 57  12
         return remoteObj;
 58  
     }
 59  
 }