1 24 package org.objectweb.joram.client.jms.admin; 25 26 import javax.naming.*; 27 28 import org.objectweb.joram.shared.JoramTracing; 29 import org.objectweb.util.monolog.api.BasicLevel; 30 31 35 public class ObjectFactory implements javax.naming.spi.ObjectFactory { 36 37 38 public Object getObjectInstance(Object obj, 39 Name name, 40 Context ctx, 41 java.util.Hashtable env) throws Exception { 42 if (JoramTracing.dbgClient.isLoggable(BasicLevel.DEBUG)) 43 JoramTracing.dbgClient.log(BasicLevel.DEBUG, 44 "ObjectFactory.getObjectInstance(" + 45 obj + ',' + name + ',' + 46 ctx + ',' + env + ')'); 47 48 Reference ref = (Reference) obj; 49 AdministeredObject ao = null; 50 try { 51 Class clazz = Class.forName(ref.getClassName()); 52 ao = (AdministeredObject) clazz.newInstance(); 53 ao.fromReference(ref); 54 } catch (Exception exc) { 55 if (JoramTracing.dbgClient.isLoggable(BasicLevel.ERROR)) 56 JoramTracing.dbgClient.log(BasicLevel.ERROR, "", exc); 57 } 58 return ao; 59 } 60 } 61 | Popular Tags |