1 package dinamica.security; 2 3 import dinamica.*; 4 import javax.sql.DataSource ; 5 import java.sql.*; 6 7 15 public class GetLoginHistory extends GenericTransaction 16 { 17 18 21 public int service(Recordset inputParams) throws Throwable 22 { 23 24 super.service(inputParams); 25 26 String jndiName = (String )getContext().getAttribute("dinamica.security.datasource"); 28 if (jndiName==null) 29 throw new Throwable ("Context attribute [dinamica.security.datasource] is null, check your security filter configuration."); 30 31 DataSource ds = Jndi.getDataSource(jndiName); 33 Connection conn = ds.getConnection(); 34 this.setConnection(conn); 35 36 try 37 { 38 39 Db db = getDb(); 41 42 Recordset rs = db.get(getSQL(getResource("query.sql"), inputParams)); 44 45 publish("query.sql", rs); 46 47 } 48 catch (Throwable e) 49 { 50 throw e; 51 } 52 finally 53 { 54 if (conn!=null) 55 conn.close(); 56 } 57 58 return 0; 59 60 } 61 62 } 63 | Popular Tags |