1 24 package fr.dyade.aaa.jndi2.msg; 25 26 import javax.naming.*; 27 28 import org.objectweb.util.monolog.api.BasicLevel; 29 import org.objectweb.util.monolog.api.Logger; 30 31 public class LookupReply extends JndiReply { 32 33 public static final Logger logger = fr.dyade.aaa.util.Debug.getLogger( 34 LookupReply.class.getName()); 35 36 private Object obj; 37 38 public LookupReply(Object obj) { 39 this.obj = obj; 40 } 41 42 public final Object getObject() throws NamingException { 43 return resolveObject(obj); 44 } 45 46 public final static Object resolveObject(Object obj) throws NamingException { 47 if (obj instanceof Reference) { 48 try { 49 return javax.naming.spi.NamingManager.getObjectInstance( 50 obj, null, null, null); 51 } catch (Exception e) { 52 if (logger.isLoggable(BasicLevel.DEBUG)) 53 logger.log(BasicLevel.DEBUG, "", e); 54 NamingException ne = new NamingException(e.getMessage()); 55 ne.setRootCause(e); 56 throw ne; 57 } 58 } else { 59 return obj; 60 } 61 } 62 } 63 | Popular Tags |