taylor      2005/01/11 01:32:32

  Modified:    applications/demo/src/webapp/WEB-INF/demo/css css.jsp
               applications/demo/src/webapp/WEB-INF/view database-help.vm
               
applications/gems/src/java/org/apache/portals/gems/browser/resources
                        Browser.properties Browser_en.properties
                        Browser_de.properties
               applications/demo project.xml
               applications/gems/src/java/org/apache/portals/gems/browser
                        BrowserPortlet.java DatabaseBrowserPortlet.java
               applications/demo/src/webapp/WEB-INF portlet.xml
               applications/demo/src/webapp/WEB-INF/velocity
                        velocity-macros.vm
  Added:       applications/demo/src/webapp/WEB-INF/view database-edit.vm
  Log:
  - continuing work on DatabaseBrowserPortlet
  - added support for 3 kinds of connections
    1. JNDI Datasource
    2. DBCP
    3. SSO
  
  only #2 above is tested and working
  still under construction
  
  Revision  Changes    Path
  1.3       +3 -3      
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/demo/css/css.jsp
  
  Index: css.jsp
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/demo/css/css.jsp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- css.jsp   6 Nov 2004 22:42:10 -0000       1.2
  +++ css.jsp   11 Jan 2005 09:32:25 -0000      1.3
  @@ -54,7 +54,7 @@
   <div class="portlet-section-subheader"><fmt:message 
key="css.label.PLTC5"/></div><br/>
   <div class="portlet-section-text">
   portlet-form-label <fmt:message key="css.label.style"/>: <font 
class="portlet-form-label"><fmt:message key="css.label.ThisIsForm"/></font><br/>
  -portlet-form-label-field <fmt:message key="css.label.style"/>: <input 
type="text" value="<fmt:message key="css.label.Value"/>" 
class="portlet-form-label"/><br/>
  +portlet-form-field-label <fmt:message key="css.label.style"/>: <input 
type="text" value="<fmt:message key="css.label.Value"/>" 
class="portlet-form-label"/><br/>
   portlet-form-button <fmt:message key="css.label.style"/>: <input 
type="button" value="<fmt:message key="css.label.Button"/>" 
class="portlet-form-button"/><br/>
   portlet-icon-label <fmt:message key="css.label.style"/>: <font 
class="portlet-icon-label"><fmt:message key="css.label.Save"/></font><br/>
   portlet-dlg-icon-label <fmt:message key="css.label.style"/>: <font 
class="portlet-dlg-icon-label"><fmt:message key="css.label.OK"/></font><br/>
  @@ -81,14 +81,14 @@
     <tr>
       <th class="portlet-section-alternate"><font 
class="portlet-form-field-label"><fmt:message 
key="css.label.JetspeedID"/></font></th>
       <td>
  -      <input type="text" name="#" value="admin" size="15" maxlength="15"  
class="portlet-form-label-field"/>
  +      <input type="text" name="#" value="admin" size="15" maxlength="15"  
class="portlet-form-field-label"/>
         <p class="portlet-form-field"><fmt:message 
key="css.label.IDConsistsOf"/></p>
       </td>
     </tr>
     <tr>
       <th class="portlet-section-alternate"><font 
class="portlet-form-field-label"><fmt:message 
key="css.label.Password"/></font></th>
       <td>
  -      <input type="password" name="#" value="abcdefg" size="10" 
maxlength="10" class="portlet-form-label-field"/> 
  +      <input type="password" name="#" value="abcdefg" size="10" 
maxlength="10" class="portlet-form-field-label"/> 
       </td>
     </tr>
     <tr>
  
  
  
  1.2       +15 -1     
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-help.vm
  
  Index: database-help.vm
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-help.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- database-help.vm  23 Dec 2004 06:27:42 -0000      1.1
  +++ database-help.vm  11 Jan 2005 09:32:25 -0000      1.2
  @@ -1 +1,15 @@
  -<b>TODO: write help</b>

  +<p>TODO: arguably the long descriptive strings here shouldn't be localized 
by resource bundles but by file i.e. database-help_en.vm etc </b>

  +

  +<h3 class="portlet-section-header">$MESSAGES.getString('label.prefs')</h3>

  +

  +<table border="0" cellspacing="2" cellpadding="3">

  +<tr>

  +  <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jndi")</font></th>

  +    <td>

  +      <input type="input" name="jndi.ds" value="" size="30" maxlength="30" 
class="portlet-form-field-label"/> 

  +    </td>  

  +    <td>

  +      <input type="input" name="jndi.ds" value="" size="30" maxlength="30" 
class="portlet-form-field-label"/> 

  +    </td>      

  +</tr>

  +</table>

  
  
  
  1.1                  
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/view/database-edit.vm
  
  Index: database-edit.vm
  ===================================================================
  #set ($MESSAGES = $portletConfig.getResourceBundle($renderRequest.Locale))

  #set ($dst = $prefsMap.get('DatasourceType'))

  #set ($disableDS = "disabled")

  #set ($disableDBCP = "disabled")

  #set ($disableSSO = "disabled")

  #if ($!dst == 'jndi')

  #set ($disableDS = "")

  #elseif ($!dst == 'dbcp')

  #set ($disableDBCP = "")

  #elseif ($!dst == 'sso')

  #set ($disableSSO = "")

  #end

  

  <h3 class="portlet-section-header">$MESSAGES.getString('label.prefs')</h3>

  

  <form name='J2DBEdit' action="$renderResponse.createActionURL()" 
method="post">

  <table border="0" cellspacing="2" cellpadding="3">

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString('label.datasource.type')</font></th>

      <td>

        <div>

          <input type="radio" default name="DatasourceType" value='jndi' #if 
($dst == 'jndi') checked #end onClick="javascript:chooseDS();"/> <font 
class="portlet-form-field-label">$MESSAGES.getString("label.datasource.jndi")</font>

        </div>

        <div>

          <input type="radio" name="DatasourceType" value='dbcp' #if ($dst == 
'dbcp') checked #end onClick="javascript:chooseDBCP();"/> <font 
class="portlet-form-field-label">$MESSAGES.getString("label.datasource.dbcp")</font>

        </div>

        <div>

          <input type="radio" name="DatasourceType" value='sso' #if ($dst == 
'sso') checked #end onClick="javascript:chooseSSO();"/> <font 
class="portlet-form-field-label">$MESSAGES.getString("label.datasource.sso")</font>

        </div>

        <p class="portlet-form-field">$MESSAGES.getString('label.select.ds')</p>

      </td>

    </tr>

  </table>

  

  <h4 
class="portlet-section-header">$MESSAGES.getString('label.jndi.settings')</h4>

  

  <table border="0" cellspacing="2" cellpadding="3">

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jndi")</font></th>

      <td>

        <input name='JndiDatasource' $!disableDS type="input" 
value="$!prefsMap.get('JndiDatasource')" size="30" maxlength="30" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

  </table>

  

  <h4 
class="portlet-section-header">$MESSAGES.getString('label.dbcp.settings')</h4>

  

  <table border="0" cellspacing="2" cellpadding="3">  

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jdbc.driver")</font></th>

      <td>

        <input type="input" name="JdbcDriver" $!disableDBCP  
value="$!prefsMap.get('JdbcDriver')" size="60" maxlength="60" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jdbc.connection")</font></th>

      <td>

        <input type="input" name="JdbcConnection" $!disableDBCP 
value="$!prefsMap.get('JdbcConnection')" size="60" maxlength="60" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jdbc.username")</font></th>

      <td>

        <input type="input" name="JdbcUsername" $!disableDBCP 
value="$!prefsMap.get('JdbcUsername')" size="30" maxlength="30" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.jdbc.password")</font></th>

      <td>

        <input type="password" name="JdbcPassword" $!disableDBCP 
value="$!prefsMap.get('JdbcPassword')" size="30" maxlength="30" 
class="portlet-form-field-label"/> 

      </td>

    </tr>  

  </table>

  

  <h4 
class="portlet-section-header">$MESSAGES.getString('label.sso.settings')</h4>

  

  <table border="0" cellspacing="2" cellpadding="3">

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">SSO Site</font></th>

      <td>

        <input type="input" name="SSOSite" $!disableSSO 
value="$!prefsMap.get('SSOSite')" size="60" maxlength="60" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">SSO Remote Principal</font></th>

      <td>

        <input type="input" name="SSOPrincipal" $!disableSSO 
value="$!prefsMap.get('SSOPrincipal')" size="60" maxlength="60" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    </tr>  

  </table>

  

  <h4 
class="portlet-section-header">$MESSAGES.getString('label.general.settings')</h4>

  <table border="0" cellspacing="2" cellpadding="3">

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.window.size")</font></th>

      <td>

        <input type="input" name="windowSize" 
value="$!prefsMap.get('windowSize')" size="5" maxlength="5" 
class="portlet-form-field-label"/> 

      </td>

    </tr>

    <tr>

      <th class="portlet-section-alternate"><font 
class="portlet-form-field-label">$MESSAGES.getString("label.sql")</font></th>

      <td>

        <textarea name="sql" cols='60' rows='8' 
class="portlet-form-field-label">$!prefsMap.get('sql')</textarea>

      </td>

    </tr>

  </table>

  

  <input type="submit" name="Save" value="Save" 
onClick="javascript:presave();"/>

  <input type="submit" name="Test" value="Test" 
onClick="javascript:presave();"/>

  

  </form>

  

  <script language="JavaScript">

  

    function chooseDS() 

    {

      disableDS(false);

      disableDBCP(true);

      disableSSO(true);

    }

  

    function chooseDBCP() 

    {

      disableDS(true);

      disableDBCP(false);

      disableSSO(true);

    }

  

    function chooseSSO() 

    {

      disableDS(true);

      disableDBCP(true);

      disableSSO(false);

    }

  

    function disableDS(flag) 

    {

      document.forms['J2DBEdit'].JndiDatasource.disabled = flag;            

    }

  

    function disableDBCP(flag) 

    {

      document.forms['J2DBEdit'].JdbcDriver.disabled = flag;            

      document.forms['J2DBEdit'].JdbcConnection.disabled = flag;            

      document.forms['J2DBEdit'].JdbcUsername.disabled = flag;            

      document.forms['J2DBEdit'].JdbcPassword.disabled = flag;            

    }

  

    function disableSSO(flag) 

    {

      document.forms['J2DBEdit'].SSOSite.disabled = flag;            

      document.forms['J2DBEdit'].SSOPrincipal.disabled = flag;                

    }

  

    function presave()

    {

      disableDS(false);

      disableDBCP(false);

      disableSSO(false);

    }

  

  </script>

  
  
  
  1.2       +21 -0     
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser.properties
  
  Index: Browser.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Browser.properties        31 Dec 2004 23:59:09 -0000      1.1
  +++ Browser.properties        11 Jan 2005 09:32:28 -0000      1.2
  @@ -11,3 +11,24 @@
   dbnext = Next
   dbprev = Previous
   dbrefresh = Refresh
  +label.datasource.type = Data Source Type
  +label.datasource.jndi = JNDI Data Source
  +label.datasource.dbcp = DBCP Data Source
  +label.datasource.sso = SSO Credential Store
  +label.select.ds = Please Select a Data Source Type
  +label.jndi = JNDI Data Source
  +label.dbcp = DBCP Data Source
  +label.sso = SSO Credential Store
  +label.prefs = Database Browser Preferences
  +label.jndi.settings = JNDI Settings
  +label.dbcp.settings = JDBC/DBCP Settings
  +label.sso.settings = J2 SSO Settings
  +label.general.settings = General Settings
  +label.jdbc.driver = JDBC Driver
  +label.jdbc.connection = JDBC Connection
  +label.jdbc.username = JDBC Username
  +label.jdbc.password = JDBC Password
  +label.window.size = Window Size
  +label.sql = SQL
  +
  +
  
  
  
  1.2       +19 -0     
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_en.properties
  
  Index: Browser_en.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_en.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Browser_en.properties     31 Dec 2004 23:59:09 -0000      1.1
  +++ Browser_en.properties     11 Jan 2005 09:32:28 -0000      1.2
  @@ -11,4 +11,23 @@
   dbnext = Next
   dbprev = Previous
   dbrefresh = Refresh
  +label.datasource.type = Data Source Type
  +label.datasource.jndi = JNDI Data Source
  +label.datasource.dbcp = DBCP Data Source
  +label.datasource.sso = SSO Credential Store
  +label.select.ds = Please Select a Data Source Type
  +label.jndi = JNDI Data Source
  +label.dbcp = DBCP Data Source
  +label.sso = SSO Credential Store
  +label.prefs = Database Browser Preferences
  +label.jndi.settings = JNDI Settings
  +label.dbcp.settings = JDBC/DBCP Settings
  +label.sso.settings = J2 SSO Settings
  +label.general.settings = General Settings
  +label.jdbc.driver = JDBC Driver
  +label.jdbc.connection = JDBC Connection
  +label.jdbc.username = JDBC Username
  +label.jdbc.password = JDBC Password
  +label.window.size = Window Size
  +label.sql = SQL
   
  
  
  
  1.2       +20 -1     
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_de.properties
  
  Index: Browser_de.properties
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_de.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Browser_de.properties     31 Dec 2004 23:59:09 -0000      1.1
  +++ Browser_de.properties     11 Jan 2005 09:32:28 -0000      1.2
  @@ -11,5 +11,24 @@
   dbnext = Weiter
   dbprev = Zuruck
   dbrefresh = Erneuern
  -  
  +label.datasource.type = Data Source Type
  +label.datasource.jndi = JNDI Data Source
  +label.datasource.dbcp = DBCP Data Source
  +label.datasource.sso = SSO Credential Store
  +label.select.ds = Please Select a Data Source Type
  +label.jndi = JNDI Data Source
  +label.dbcp = DBCP Data Source
  +label.sso = SSO Credential Store
  +label.prefs = Database Browser Preferences
  +label.jndi.settings = JNDI Settings
  +label.dbcp.settings = JDBC/DBCP Settings
  +label.sso.settings = J2 SSO Settings
  +label.general.settings = General Settings
  +label.jdbc.driver = JDBC Driver
  +label.jdbc.connection = JDBC Connection
  +label.jdbc.username = JDBC Username
  +label.jdbc.password = JDBC Password
  +label.window.size = Window Size
  +label.sql = SQL
  +
     
  
  
  
  1.28      +22 -1     jakarta-jetspeed-2/applications/demo/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/demo/project.xml,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- project.xml       31 Dec 2004 23:59:10 -0000      1.27
  +++ project.xml       11 Jan 2005 09:32:29 -0000      1.28
  @@ -48,7 +48,28 @@
               <properties>
                   <war.bundle>true</war.bundle>
               </properties>
  -        </dependency>                                
  +        </dependency>        
  +         <dependency>
  +           <id>commons-collections</id>
  +           <version>3.0</version>
  +           <properties>
  +             <war.bundle>true</war.bundle>
  +           </properties>
  +         </dependency>        
  +         <dependency>
  +           <id>commons-pool</id>
  +           <version>1.2</version>
  +           <properties>
  +             <war.bundle>true</war.bundle>
  +           </properties>
  +         </dependency>
  +         <dependency>
  +           <id>commons-dbcp</id>
  +           <version>1.2.1</version>
  +           <properties>
  +             <war.bundle>true</war.bundle>
  +           </properties>
  +         </dependency>                                       
           <dependency>
               <groupId>jstl</groupId>
               <artifactId>jstl</artifactId>
  
  
  
  1.2       +2 -1      
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserPortlet.java
  
  Index: BrowserPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserPortlet.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BrowserPortlet.java       3 Jan 2005 08:14:29 -0000       1.1
  +++ BrowserPortlet.java       11 Jan 2005 09:32:30 -0000      1.2
  @@ -54,7 +54,7 @@
   
       protected static final String CUSTOMIZE_TEMPLATE = "customizeTemplate";
   
  -    protected static final String WINDOW_SIZE = "windowSize";
  +    protected static final String WINDOW_SIZE = "WindowSize";
   
       protected static final String USER_OBJECT_NAMES = "user-object-names";
   
  @@ -217,6 +217,7 @@
           if (request.getPortletMode() == PortletMode.EDIT)
           {
               processPreferencesAction(request, response);
  +            clearBrowserIterator(request);            
           } else
           {
               String browserAction = request.getParameter("db.browser.action");
  
  
  
  1.4       +66 -46    
jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserPortlet.java
  
  Index: DatabaseBrowserPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserPortlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DatabaseBrowserPortlet.java       3 Jan 2005 08:14:29 -0000       1.3
  +++ DatabaseBrowserPortlet.java       11 Jan 2005 09:32:30 -0000      1.4
  @@ -15,9 +15,8 @@
    */
   package org.apache.portals.gems.browser;
   
  +import java.io.IOException;
   import java.sql.Connection;
  -import java.sql.Driver;
  -import java.sql.DriverManager;
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
   import java.sql.ResultSetMetaData;
  @@ -30,10 +29,17 @@
   import javax.naming.Context;
   import javax.naming.InitialContext;
   import javax.naming.NamingException;
  +import javax.portlet.ActionRequest;
  +import javax.portlet.ActionResponse;
  +import javax.portlet.PortletException;
  +import javax.portlet.PortletMode;
  +import javax.portlet.PortletPreferences;
   import javax.portlet.PortletSession;
   import javax.portlet.RenderRequest;
   import javax.sql.DataSource;
   
  +import org.apache.commons.dbcp.BasicDataSource;
  +
   /**
    * DatabaseBrowserPortlet
    * 
  @@ -70,7 +76,7 @@
               String poolname = getPreference(request, POOLNAME, null);
               if (poolname == null || poolname.length() == 0)
               {
  -                con = getConnection();
  +                con = getConnection(request);
               } 
               else
               {
  @@ -209,56 +215,53 @@
       /*
        * Connection Management: TODO: rethink this, current impl is a quick 
prototype
        */
  -    
  -    private boolean driverRegistered = false;
  -    
  -    public Connection getConnection()
  -    {
           
  +    public Connection getConnection(RenderRequest request)
  +    throws Exception // TODO: switch to Edit Mode on failure
  +    {
           Connection con = null;
  -        try 
  +        try
           {
  -            if (driverRegistered == false)
  +            PortletPreferences prefs = request.getPreferences();
  +            String dsType = prefs.getValue("DatasourceType", null);
  +            if (dsType == null)
               {
  -                Class driverClass = Class.forName("com.mysql.jdbc.Driver");
  -                //Class driverClass = Class.forName("org.hsqldb.jdbcDriver");
  -                Driver driver = (Driver)driverClass.newInstance();
  -                DriverManager.registerDriver(driver);
  -                driverRegistered = true;
  -            }
  -            //con = 
DriverManager.getConnection("jdbc:mysql://192.168.2.55/GWLogDB", "david", 
"david");
  -            //con = 
DriverManager.getConnection("jdbc:hsqldb:hsql://127.0.0.1:9001", "sa", "");
  -            con = DriverManager.getConnection("jdbc:mysql://j2-server/j2", 
"j2", "digital");
  -            
  -            Context ctx = new InitialContext();
  -            DataSource ds = (DataSource)ctx.lookup("java:/jdbc/jetspeed");   
         
  -            System.out.println("Got DataSource: " + ds);
  -            
  -        }
  -        catch (NamingException ne)
  -        {
  -            System.err.println("error getting datas source " + ne);
  -            log.error("Cant get jetspeed data source", ne);                  
                 
  -        }
  -        catch (ClassNotFoundException cnfe) 
  -        {
  -            log.error("Cant get class for JDBC driver", cnfe);            
  +                throw new SQLException("No DataSource provided"); 
  +            }
  +            if (dsType.equals("jndi"))
  +            {
  +                Context ctx = new InitialContext();
  +                DataSource ds = 
(DataSource)ctx.lookup(prefs.getValue("JndiDatasource", ""));
  +//              DataSource ds = 
(DataSource)ctx.lookup("java:/jdbc/jetspeed");
  +                con = ds.getConnection();
  +            }
  +            else if (dsType.equals("dbcp"))
  +            {
  +                BasicDataSource ds = new BasicDataSource();
  +                  ds.setDriverClassName(prefs.getValue("JdbcDriver", ""));
  +                  ds.setUrl(prefs.getValue("JdbcConnection", ""));           
                                                                           
  +                  ds.setUsername(prefs.getValue("JdbcUsername", ""));
  +                  ds.setPassword(prefs.getValue("JdbcPassword", ""));
  +    //            ds.setUrl("jdbc:mysql://j2-server/j2");
  +                  con = ds.getConnection();                  
  +            }
  +            else if (dsType.equals("sso"))
  +            {
  +                // TODO: write this
  +            }
  +            else
  +            {
  +                throw new SQLException("No DataSource provided");            
     
  +            }
  +                        
           }
  -        catch (InstantiationException ie) 
  +        catch (Exception e)
           {
  -            log.error("Cant instantiate class for JDBC driver", ie);         
   
  +            throw new Exception("Failed to connect", e); // TODO: complete 
this 
           }
  -        catch (IllegalAccessException iae) 
  -        {
  -            log.error("Illegal Access for JDBC driver", iae);            
  -        }        
  -        catch (SQLException se) 
  -        {
  -            log.error("Cant get connection", se);
  -        }         
  -       return con; 
  +        return con;
       }
  -    
  +        
       public Connection getConnection(String poolName)
       {
           return null;
  @@ -276,4 +279,21 @@
           }         
           
       }
  +    
  +    
  +    public void processAction(ActionRequest request, ActionResponse response)
  +    throws PortletException, IOException
  +    {
  +        if (request.getPortletMode() == PortletMode.EDIT)
  +        {
  +            String test = request.getParameter("Test");
  +            if (test != null && test.equals("Test"))
  +            {
  +                // test the connection - TODO: write this tomorrow :)
  +                System.out.println("Handle TEST processing");
  +            }
  +        }
  +        super.processAction(request, response);
  +    }
  +    
   }
  
  
  
  1.33      +36 -4     
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml
  
  Index: portlet.xml
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/portlet.xml,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- portlet.xml       3 Jan 2005 08:14:33 -0000       1.32
  +++ portlet.xml       11 Jan 2005 09:32:31 -0000      1.33
  @@ -605,7 +605,7 @@
        </init-param>   
       <init-param>
                <name>EditPage</name>
  -                     <value>/WEB-INF/view/edit-prefs.vm</value>
  +                     <value>/WEB-INF/view/database-edit.vm</value>
        </init-param>   
       <init-param>
                <name>HelpPage</name>
  @@ -623,12 +623,44 @@
       
<resource-bundle>org.apache.portals.gems.browser.resources.Browser</resource-bundle>
            
       <portlet-preferences>
         <preference>                            
  -        <name>windowSize</name>                    
  -        <value>8</value>    
  +        <name>DatasourceType</name>                    
  +        <value>dbcp</value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>JndiDatasource</name>                    
  +        <value></value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>JdbcDriver</name>                    
  +        <value>org.hsqldb.jdbcDriver</value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>JdbcConnection</name>                    
  +        <value>jdbc:hsqldb:hsql://127.0.0.1:9001</value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>JdbcUsername</name>                    
  +        <value>sa</value>    
  +      </preference>                               
  +      <preference>                            
  +        <name>JdbcPassword</name>                    
  +        <value></value>    
  +      </preference>                                   
  +      <preference>                            
  +        <name>SSOSite</name>                    
  +        <value></value>    
  +      </preference>                                   
  +      <preference>                            
  +        <name>SSOPrincipal</name>                    
  +        <value></value>    
  +      </preference>                                   
  +      <preference>                            
  +        <name>WindowSize</name>                    
  +        <value>10</value>    
         </preference>                                          
         <preference>                            
           <name>sql</name>                    
  -        <value>select * from SECURITY_PRINCIPAL</value>    
  +        <value>select * from CLUBS</value>    
         </preference>                               
       </portlet-preferences>        
     </portlet>
  
  
  
  1.4       +2 -2      
jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/velocity/velocity-macros.vm
  
  Index: velocity-macros.vm
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed-2/applications/demo/src/webapp/WEB-INF/velocity/velocity-macros.vm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- velocity-macros.vm        1 Dec 2004 01:28:47 -0000       1.3
  +++ velocity-macros.vm        11 Jan 2005 09:32:32 -0000      1.4
  @@ -37,7 +37,7 @@
     #end
       <td nowrap class="portlet-section-alternate" 
align="right">$!MESSAGES.getString($label):&nbsp;</td>
       <td class="portlet-section-body" align="left">
  -      <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" 
class="portlet-form-label-field">
  +      <input id="$!id" type="text" name="$!id" size="$!size" value="$!value" 
class="portlet-form-field-label">
       </td>
       <td width="5%" class="portlet-form-label" align="left">&nbsp;</td>
     </tr>
  @@ -85,7 +85,7 @@
     #end
       <td nowrap class="portlet-section-alternate" 
align="right">$!key:&nbsp;</td>
       <td class="portlet-section-body" align="left">
  -      <input id="$!id" type="text" name="$!key" size="$!size" value="$!extr" 
class="portlet-form-label-field">
  +      <input id="$!id" type="text" name="$!key" size="$!size" value="$!extr" 
class="portlet-form-field-label">
       </td>
       <td width="5%" class="portlet-form-label" align="left">&nbsp;</td>
     </tr>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to