1 28 29 package com.caucho.config.types; 30 31 import com.caucho.util.L10N; 32 33 import javax.naming.InitialContext ; 34 import javax.naming.NamingException ; 35 36 39 public class JndiBuilder { 40 static L10N L = new L10N(JndiBuilder.class); 41 42 private String _jndiName; 43 44 47 public void addText(String text) 48 { 49 _jndiName = text; 50 } 51 52 55 public String getJndiName() 56 { 57 return _jndiName; 58 } 59 60 63 public Object getObject() 64 throws NamingException 65 { 66 if (_jndiName.startsWith("java:comp/")) 67 return new InitialContext ().lookup(_jndiName); 68 else 69 return new InitialContext ().lookup("java:comp/env/" + _jndiName); 70 } 71 } 72 | Popular Tags |