User: starksm Date: 01/11/27 22:15:32 Modified: src/main/org/jboss/mq/referenceable Tag: Branch_2_4 SpyConnectionFactoryObjectFactory.java SpyDestinationObjectFactory.java Log: Complete switch to org.jboss.logging.Logger and use trace to reduce default logging Add support for package version manifest headers Revision Changes Path No revision No revision 1.2.2.2 +24 -18 jbossmq/src/main/org/jboss/mq/referenceable/SpyConnectionFactoryObjectFactory.java Index: SpyConnectionFactoryObjectFactory.java =================================================================== RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/referenceable/SpyConnectionFactoryObjectFactory.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- SpyConnectionFactoryObjectFactory.java 2001/08/23 03:57:12 1.2.2.1 +++ SpyConnectionFactoryObjectFactory.java 2001/11/28 06:15:31 1.2.2.2 @@ -8,6 +8,7 @@ import javax.naming.spi.ObjectFactory; +import org.jboss.logging.Logger; import org.jboss.mq.GenericConnectionFactory; /** @@ -17,13 +18,12 @@ * * @author Hiram Chirino ([EMAIL PROTECTED]) * @created August 16, 2001 - * @version $Revision: 1.2.2.1 $ + * @version $Revision: 1.2.2.2 $ */ -public class SpyConnectionFactoryObjectFactory implements javax.naming.spi.ObjectFactory { - - static org.apache.log4j.Category cat = org.apache.log4j.Category.getInstance( SpyConnectionFactoryObjectFactory.class ); - - +public class SpyConnectionFactoryObjectFactory implements javax.naming.spi.ObjectFactory +{ + private static Logger log = Logger.getLogger( SpyConnectionFactoryObjectFactory.class ); + /** * getObjectInstance method. * @@ -34,23 +34,29 @@ * @return The ObjectInstance value * @exception java.lang.Exception Description of Exception */ - public java.lang.Object getObjectInstance( java.lang.Object reference, javax.naming.Name name, javax.naming.Context contex, java.util.Hashtable properties ) - throws java.lang.Exception { - - cat.debug( "SpyConnectionFactoryObjectFactory->getObjectInstance()" ); - try { - + public java.lang.Object getObjectInstance(Object reference, javax.naming.Name name, javax.naming.Context contex, java.util.Hashtable properties ) + throws Exception + { + if( log.isTraceEnabled() ) + log.trace( "SpyConnectionFactoryObjectFactory->getObjectInstance()" ); + try + { javax.naming.Reference ref = ( javax.naming.Reference )reference; GenericConnectionFactory dcf = ( GenericConnectionFactory ) - ObjectRefAddr.extractObjectRefFrom( ref, "DCF" ); - - if ( ref.getClassName().equals( "org.jboss.mq.SpyConnectionFactory" ) ) { + ObjectRefAddr.extractObjectRefFrom( ref, "DCF" ); + + if ( ref.getClassName().equals( "org.jboss.mq.SpyConnectionFactory" ) ) + { return new org.jboss.mq.SpyConnectionFactory( dcf ); - } else if ( ref.getClassName().equals( "org.jboss.mq.SpyXAConnectionFactory" ) ) { + } + else if ( ref.getClassName().equals( "org.jboss.mq.SpyXAConnectionFactory" ) ) + { return new org.jboss.mq.SpyXAConnectionFactory( dcf ); } - } catch ( Throwable ignore ) { - ignore.printStackTrace(); + } + catch ( Throwable ignore ) + { + log.debug("Unexpected error", ignore); // This method should not throw an exception since // It would prevent another ObjectFactory from attempting // to create an instance of the object. 1.2.2.2 +33 -20 jbossmq/src/main/org/jboss/mq/referenceable/SpyDestinationObjectFactory.java Index: SpyDestinationObjectFactory.java =================================================================== RCS file: /cvsroot/jboss/jbossmq/src/main/org/jboss/mq/referenceable/SpyDestinationObjectFactory.java,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -u -r1.2.2.1 -r1.2.2.2 --- SpyDestinationObjectFactory.java 2001/08/23 03:57:12 1.2.2.1 +++ SpyDestinationObjectFactory.java 2001/11/28 06:15:31 1.2.2.2 @@ -8,25 +8,29 @@ import javax.naming.spi.ObjectFactory; +import org.jboss.logging.Logger; + /** * This class is used to create instances of of: SpyTopic SpyQueue classes from * a javax.naming.Reference instance. * * @author Hiram Chirino ([EMAIL PROTECTED]) * @created August 16, 2001 - * @version $Revision: 1.2.2.1 $ + * @version $Revision: 1.2.2.2 $ */ -public class SpyDestinationObjectFactory implements javax.naming.spi.ObjectFactory { - - static org.apache.log4j.Category cat = org.apache.log4j.Category.getInstance( SpyDestinationObjectFactory.class ); - +public class SpyDestinationObjectFactory implements javax.naming.spi.ObjectFactory +{ + + static Logger log = Logger.getLogger( SpyDestinationObjectFactory.class ); + /** * SpyTopicObjectFactory constructor */ - public SpyDestinationObjectFactory() { + public SpyDestinationObjectFactory() + { super(); } - + /** * getObjectInstance method * @@ -37,25 +41,34 @@ * @return The ObjectInstance value * @exception java.lang.Exception Description of Exception */ - public java.lang.Object getObjectInstance( java.lang.Object reference, javax.naming.Name name, javax.naming.Context contex, java.util.Hashtable properties ) - throws java.lang.Exception { - - cat.debug( "SpyDestinationObjectFactory->getObjectInstance()" ); - - try { - + public java.lang.Object getObjectInstance(Object reference, javax.naming.Name name, javax.naming.Context contex, java.util.Hashtable properties ) + throws Exception + { + if( log.isTraceEnabled() ) + log.trace( "SpyDestinationObjectFactory->getObjectInstance()" ); + + try + { + javax.naming.Reference ref = ( javax.naming.Reference )reference; - if ( ref.getClassName().equals( "org.jboss.mq.SpyTopic" ) ) { - + if ( ref.getClassName().equals( "org.jboss.mq.SpyTopic" ) ) + { + String dest = ( String )ref.get( "name" ).getContent(); return new org.jboss.mq.SpyTopic( dest ); - } else if ( ref.getClassName().equals( "org.jboss.mq.SpyQueue" ) ) { - + } + else if ( ref.getClassName().equals( "org.jboss.mq.SpyQueue" ) ) + { + String dest = ( String )ref.get( "name" ).getContent(); return new org.jboss.mq.SpyQueue( dest ); } - } catch ( RuntimeException ignore ) { - } catch ( Exception ignore ) { + } + catch ( RuntimeException ignore ) + { + } + catch ( Exception ignore ) + { // This method should not throw an exception since // It would prevent another ObjectFactory from attempting // to create an instance of the object.
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development