Coverage Report - org.mule.module.jca.DefaultMuleConnectionFactory
 
Classes in this File Line Coverage Branch Coverage Complexity
DefaultMuleConnectionFactory
0%
0/23
N/A
1
 
 1  
 /*
 2  
  * $Id: DefaultMuleConnectionFactory.java 10789 2008-02-12 20:04:43Z 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.module.jca;
 12  
 
 13  
 import java.io.IOException;
 14  
 import java.io.ObjectInputStream;
 15  
 
 16  
 import javax.naming.Reference;
 17  
 import javax.resource.ResourceException;
 18  
 import javax.resource.spi.ConnectionManager;
 19  
 
 20  
 import org.apache.commons.logging.Log;
 21  
 import org.apache.commons.logging.LogFactory;
 22  
 
 23  
 /**
 24  
  * <code>DefaultMuleConnectionFactory</code> an implementation of the
 25  
  * MuleconnectionFactory interface used by clients of this ResourceAdapter to obtain
 26  
  * a connection to Mule resources.
 27  
  */
 28  
 public class DefaultMuleConnectionFactory implements MuleConnectionFactory
 29  
 {
 30  
     /**
 31  
      * Serial version
 32  
      */
 33  
     private static final long serialVersionUID = 1552386015565975623L;
 34  
 
 35  
     /**
 36  
      * logger used by this class
 37  
      */
 38  0
     protected transient Log logger = LogFactory.getLog(this.getClass());
 39  
 
 40  
     private transient ConnectionManager manager;
 41  
     private transient MuleManagedConnectionFactory factory;
 42  
     private Reference reference;
 43  
     private MuleConnectionRequestInfo info;
 44  
 
 45  
     public DefaultMuleConnectionFactory(MuleManagedConnectionFactory factory,
 46  
                                         ConnectionManager manager,
 47  
                                         MuleConnectionRequestInfo info)
 48  0
     {
 49  0
         this.factory = factory;
 50  0
         this.manager = manager;
 51  0
         this.info = info;
 52  0
     }
 53  
 
 54  
     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException
 55  
     {
 56  0
         ois.defaultReadObject();
 57  
         // TODO this is incomplete:
 58  
         // MuleManagedConnectionFactory is Serializable but marked transient?!
 59  0
         this.logger = LogFactory.getLog(this.getClass());
 60  0
     }
 61  
 
 62  
     public MuleConnection createConnection() throws ResourceException
 63  
     {
 64  0
         return createConnection(info);
 65  
     }
 66  
 
 67  
     public MuleConnection createConnection(MuleConnectionRequestInfo info) throws ResourceException
 68  
     {
 69  
         // TODO try {
 70  0
         return (MuleConnection)manager.allocateConnection(factory, info);
 71  
         // }
 72  
         // catch (ResourceException e) {
 73  
         //            
 74  
         // logger.warn("Connection could not be created: " + e.getMessage(), e);
 75  
         // throw new DefaultMuleException(e.getMessage());
 76  
         // }
 77  
     }
 78  
 
 79  
     public ConnectionManager getManager()
 80  
     {
 81  0
         return manager;
 82  
     }
 83  
 
 84  
     public void setManager(ConnectionManager manager)
 85  
     {
 86  0
         this.manager = manager;
 87  0
     }
 88  
 
 89  
     public MuleManagedConnectionFactory getFactory()
 90  
     {
 91  0
         return factory;
 92  
     }
 93  
 
 94  
     public void setFactory(MuleManagedConnectionFactory factory)
 95  
     {
 96  0
         this.factory = factory;
 97  0
     }
 98  
 
 99  
     public Reference getReference()
 100  
     {
 101  0
         return reference;
 102  
     }
 103  
 
 104  
     public void setReference(Reference reference)
 105  
     {
 106  0
         this.reference = reference;
 107  0
     }
 108  
 
 109  
     public MuleConnectionRequestInfo getInfo()
 110  
     {
 111  0
         return info;
 112  
     }
 113  
 
 114  
     public void setInfo(MuleConnectionRequestInfo info)
 115  
     {
 116  0
         this.info = info;
 117  0
     }
 118  
 }