KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ashkelon > pages > APIsPage


1 package org.ashkelon.pages;
2
3 import org.ashkelon.*;
4 import org.ashkelon.db.*;
5 import java.sql.*;
6 import java.util.*;
7
8 /**
9  * @author Eitan Suez
10  */

11 public class APIsPage extends Page
12 {
13    public APIsPage()
14    {
15       super();
16    }
17
18    public String JavaDoc handleRequest() throws SQLException
19    {
20       if (app.getAttribute("apilist")==null)
21       {
22          List apiList = getAPIList();
23          app.setAttribute("apilist", apiList);
24          if (apiList == null || apiList.size() <= 1)
25             return "pkg";
26       }
27       
28       return null;
29    }
30    
31    public List getAPIList() throws SQLException
32    {
33       String JavaDoc sql = DBMgr.getInstance().getStatement("getapis");
34
35       Statement stmt = conn.createStatement();
36       ResultSet rset = stmt.executeQuery(sql);
37       
38       List apiList = new ArrayList();
39
40       API api;
41       while (rset.next())
42       {
43          api = new API(rset.getString(2));
44          api.setId(rset.getInt(1));
45          api.setSummaryDescription(rset.getString(3));
46          api.setPublisher(rset.getString(4));
47          api.setVersion(rset.getString(5));
48          apiList.add(api);
49       }
50       
51       rset.close();
52       stmt.close();
53       
54       return apiList;
55    }
56    
57 }
58
Popular Tags