1 22 package org.jboss.mq.referenceable; 23 24 import org.jboss.logging.Logger; 25 import org.jboss.mq.GenericConnectionFactory; 26 27 36 public class SpyConnectionFactoryObjectFactory implements javax.naming.spi.ObjectFactory { 37 38 static Logger cat = Logger.getLogger( SpyConnectionFactoryObjectFactory.class ); 39 40 41 51 public java.lang.Object getObjectInstance( java.lang.Object reference, javax.naming.Name name, javax.naming.Context contex, java.util.Hashtable properties ) 52 throws java.lang.Exception { 53 54 boolean debug = cat.isDebugEnabled(); 55 if (debug) 56 cat.debug( "Extracting SpyConnectionFactory from reference" ); 57 try { 58 59 javax.naming.Reference ref = ( javax.naming.Reference )reference; 60 GenericConnectionFactory dcf = ( GenericConnectionFactory ) 61 ObjectRefAddr.extractObjectRefFrom( ref, "DCF" ); 62 63 if (debug) 64 cat.debug("The GenericConnectionFactory is: "+dcf); 65 66 if ( ref.getClassName().equals( "org.jboss.mq.SpyConnectionFactory" ) ) { 67 return new org.jboss.mq.SpyConnectionFactory( dcf ); 68 } else if ( ref.getClassName().equals( "org.jboss.mq.SpyXAConnectionFactory" ) ) { 69 return new org.jboss.mq.SpyXAConnectionFactory( dcf ); 70 } 71 } catch ( Throwable ignore ) { 72 ignore.printStackTrace(); 73 } 77 return null; 78 } 79 } 80 | Popular Tags |