1 7 package org.ejtools.jndi.browser.model.sql; 8 9 import java.sql.SQLException ; 10 11 import javax.naming.Context ; 12 import javax.rmi.PortableRemoteObject ; 13 import javax.sql.DataSource ; 14 15 import org.ejtools.jndi.browser.model.JNDIContext; 16 17 40 public class DataSourceProxy extends JNDIContext 41 { 42 43 protected DataSource source; 44 45 46 53 public DataSourceProxy(Context context, String jndiName) 54 throws Exception 55 { 56 Object o = context.lookup(jndiName); 58 source = (DataSource ) PortableRemoteObject.narrow(o, DataSource .class); 59 60 this.setName(jndiName); 61 this.setClassName(source.getClass().getName()); 62 } 63 64 65 70 public int getLoginTimeout() 71 { 72 try 73 { 74 return this.source.getLoginTimeout(); 75 } 76 catch (SQLException sqle) 77 { 78 } 79 return -1; 80 } 81 } 82 | Popular Tags |