portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed-2/applications/demo project.xml
Date Fri, 31 Dec 2004 23:59:10 GMT
taylor      2004/12/31 15:59:10

  Modified:    applications/security project.xml
               applications/demo/src/webapp/WEB-INF portlet.xml
               applications/demo project.xml
  Added:       applications/gems/src/java/org/apache/portals/gems/browser
                        BrowserIterator.java ActionParameter.java
                        Browser.java DatabaseBrowserPortlet.java
                        BrowserQuery.java AbstractBrowserPortlet.java
                        DatabaseBrowserIterator.java
               applications/gems project.xml project.properties locator.ent
                        maven.xml .cvsignore
               applications/gems/src/java/org/apache/portals/gems/browser/resources
                        Browser.properties Browser_en.properties
                        Browser_de.properties
               applications/security/src/java/org/apache/jetspeed/portlets/security/sso
                        SSOBrowser.java
  Removed:     applications/demo/src/java/org/apache/portals/applications/database/resources
                        DatabaseBrowser.properties
                        DatabaseBrowser_de.properties
                        DatabaseBrowser_en.properties
               applications/demo/src/java/org/apache/portals/applications/database
                        ActionParameter.java DatabaseBrowserIterator.java
                        DatabaseBrowserPortlet.java BrowserQuery.java
                        BrowserIterator.java
  Log:
  moved browser into new Gems project
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserIterator.java
  
  Index: BrowserIterator.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.browser;
  
  import java.io.Serializable;
  import java.util.Comparator;
  import java.util.Iterator;
  import java.util.List;
  
  /**
   * DatabaseBrowserPortlet
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: BrowserIterator.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   */
  public interface BrowserIterator extends Iterator, Comparator, Serializable
  {
  
      /**
       * This method returns the index of the row to which the cursor is pointing
       * at.
       *  
       */
      public int getTop();
  
      /**
       * This method returns the window size.
       *  
       */
      public int getWindowSize();
  
      /**
       * This method returns the last index of the row in the window displayed.
       *  
       */
      public int getBottom();
  
      /**
       * This method points the cursor to the index provided.
       * 
       * @param start
       *            Index to which cursor should point to
       */
      public void setTop(int start);
  
      /**
       * This method returns the result set vector.
       *  
       */
      public List getResultSet();
  
      /**
       * This method returns the number of rows in the result set.
       *  
       */
      public int getResultSetSize();
  
      /**
       * This method returns the List containg the column labels of the result
       * set.
       *  
       */
      public List getResultSetTitleList();
  
      /**
       * This method returns the List containg the Types of the columns the result
       * set.
       * 
       * @see java.sql.Types
       */
      public List getResultSetTypesList();
  
      /**
       * This method sorts the result set according to the value of the column as
       * specified by the parameter column name. Changes the order of the result
       * set vector. If it is called on the same columnName more than once it
       * toggles the ordering ie first it will be ascending, then it will be
       * descending, then ascending and so on.
       * 
       * @param String
       *            sortColumnName
       */
      public void sort(String sortColumnName);
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/ActionParameter.java
  
  Index: ActionParameter.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.browser;
  
  import java.io.Serializable;
  
  /**
   * Action Parameter
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: ActionParameter.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   *  
   */
  public class ActionParameter implements Serializable
  {
  
      String name;
  
      String action;
  
      String type;
  
      String page;
  
      public ActionParameter(String name, String action, String type)
      {
          this.name = name;
          if (type.equalsIgnoreCase("psml"))
          {
              int index = action.indexOf("/");
              this.page = action.substring(0, index);
              this.action = action.substring(index + 1);
          } else
          {
              this.action = action;
          }
          this.type = type;
      }
  
      public String getName()
      {
          return this.name;
      }
  
      public String getPage()
      {
          return this.page;
      }
  
      public String getAction()
      {
          return this.action;
      }
  
      public String getType()
      {
          return this.type;
      }
  
      public void setName(String name)
      {
          this.name = name;
      }
  
      public void setAction(String action)
      {
          this.action = action;
      }
  
      public void setType(String type)
      {
          this.type = type;
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/Browser.java
  
  Index: Browser.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.browser;
  
  import java.util.List;
  
  import javax.portlet.RenderRequest;
  
  
  /**
   * GemsBrowser - defines the inteface for Gems Browsers
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: Browser.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   */
  public interface Browser
  {
      void getRows(RenderRequest request, String sql, int windowSize)
      throws Exception;
      
      boolean filter(List row, RenderRequest request);    
      
      public void populate(int rowIndex, int columnIndex, List row);    
      
  }
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserPortlet.java
  
  Index: DatabaseBrowserPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  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;
  import java.sql.SQLException;
  import java.sql.Types;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Vector;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletException;
  import javax.portlet.PortletMode;
  import javax.portlet.PortletPreferences;
  import javax.portlet.PortletRequest;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
  import org.apache.velocity.context.Context;
  
  /**
   * DatabaseBrowserPortlet
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: DatabaseBrowserPortlet.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   */
  public class DatabaseBrowserPortlet 
      extends AbstractBrowserPortlet
      implements Browser
  {    
      /**
       * Execute the sql statement as specified by the user or the default, and
       * store the resultSet in a vector.
       * 
       * @param sql
       *            The sql statement to be executed.
       * @param data
       *            The turbine rundata context for this request.
       */
      public void getRows(RenderRequest request, String sql, int windowSize)
              throws Exception
      {
          List resultSetList = new ArrayList();
          List resultSetTitleList = new ArrayList();
          List resultSetTypeList = new ArrayList();
          
          Connection con = null;
          PreparedStatement selectStmt = null;
          ResultSet rs = null;
          
          PortletSession session = request.getPortletSession();
          try
          {
              String poolname = getPreference(request, POOLNAME, null);
              if (poolname == null || poolname.length() == 0)
              {
                  con = getConnection();
              } 
              else
              {
                  con = getConnection(poolname);
              }
              selectStmt = con.prepareStatement(sql);
  
              readSqlParameters(request);
              Iterator it = sqlParameters.iterator();
              int ix = 0;
              while (it.hasNext())
              {
                  ix++;
                  Object object = it.next();
                  selectStmt.setObject(ix, object);
              }
              rs = selectStmt.executeQuery();
              ResultSetMetaData rsmd = rs.getMetaData();
              int columnNum = rsmd.getColumnCount();
              /*
               * get the user object types to be displayed and add them to the
               * title list as well as the result set list
               */
              List userObjList = (List) session.getAttribute(USER_OBJECTS);
              int userObjListSize = 0;
              if (userObjList != null)
              {
                  userObjListSize = userObjList.size();
              }
              //System.out.println("User List Size = "+ userObjListSize);
              /*
               * the array columnDisplayed maintains a boolean value for each
               * column index. Only the columns that are set to true are added to
               * the resultSetList, resultSetTitleList and resultSetTypeList.
               */
              boolean[] columnDisplayed = new boolean[columnNum + userObjListSize];
  
              /*
               * this for loop constructs the columnDisplayed array as well as
               * adds to the resultSetTitleList and resultSetTypeList
               */
              for (int i = 1; i <= columnNum; i++)
              {
                  int type = rsmd.getColumnType(i);
                  if (!((type == Types.BLOB) || (type == Types.CLOB)
                          || (type == Types.BINARY)
                          || (type == Types.LONGVARBINARY) || (type == Types.VARBINARY)))
                  {
                      resultSetTitleList.add(rsmd.getColumnName(i));
                      resultSetTypeList.add(String.valueOf(type));
                      columnDisplayed[i - 1] = true;
                  } else
                  {
                      columnDisplayed[i - 1] = false;
                  }
              }
  
              for (int i = columnNum; i < columnNum + userObjListSize; i++)
              {
                  ActionParameter usrObj = (ActionParameter) userObjList.get(i
                          - columnNum);
                  resultSetTitleList.add(usrObj.getName());
                  resultSetTypeList.add(usrObj.getType());
                  columnDisplayed[i] = true;
                  //System.out.println("User List Name = "+ usrObj.getName()+"
                  // Type = "+usrObj.getType());
              }
              /*
               * this while loop adds each row to the resultSetList
               */
              int index = 0;
              while (rs.next())
              {
                  List row = new ArrayList(columnNum);
  
                  for (int i = 1; i <= columnNum; i++)
                  {
                      if (columnDisplayed[i - 1])
                      {
                          Object obj = rs.getObject(i);
                          if (obj == null)
                          {
                              obj = VELOCITY_NULL_ENTRY;
                          }
                          row.add(obj);
                      }
                  }
                  for (int i = columnNum; i < columnNum + userObjListSize; i++)
                  {
                      ActionParameter usrObj = (ActionParameter) userObjList
                              .get(i - columnNum);
                      if (columnDisplayed[i])
                      {
                          Class c = Class.forName(usrObj.getType());
                          row.add(c.newInstance());
                          populate(index, i, row);
                      }
                  }
  
                  if (filter(row, request))
                  {
                      continue;
                  }
  
                  resultSetList.add(row);
                  index++;
              }
              BrowserIterator iterator = new DatabaseBrowserIterator(
                      resultSetList, resultSetTitleList, resultSetTypeList,
                      windowSize);
              setBrowserIterator(request, iterator);
  
          } catch (SQLException e)
          {
              throw e;
          } finally
          {
              try
              {
                  if (null != selectStmt) selectStmt.close();
                  if (null != rs) rs.close();
                  if (null != con) //closes con also
                  {
                      closeConnection(con);
                  }
  
              } catch (Exception e)
              {
                  throw e;
              }
          }
  
      }
      
  
      /*
       * Connection Management: TODO: rethink this, current impl is a quick prototype
       */
      
      private boolean driverRegistered = false;
      
      public Connection getConnection()
      {
          Connection con = null;
          try 
          {
              if (driverRegistered == false)
              {
                  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");
          }
          catch (ClassNotFoundException cnfe) 
          {
              log.error("Cant get class for JDBC driver", cnfe);            
          }
          catch (InstantiationException ie) 
          {
              log.error("Cant instantiate class for JDBC driver", ie);            
          }
          catch (IllegalAccessException iae) 
          {
              log.error("Illegal Access for JDBC driver", iae);            
          }        
          catch (SQLException se) 
          {
              log.error("Cant get connection", se);
          }         
         return con; 
      }
      
      public Connection getConnection(String poolName)
      {
          return null;
      }
      
      public void closeConnection(Connection con)
      {
          try
          {
              con.close();
          }
          catch (SQLException e) 
          {
              log.error("Cant close connection", e);
          }         
          
      }
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/BrowserQuery.java
  
  Index: BrowserQuery.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.browser;
  
  import java.util.List;
  
  import javax.portlet.PortletRequest;
  
  
  import org.apache.velocity.context.Context;
  
  /**
   * Browser Query Fetch Interface
   *
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: BrowserQuery.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   *
  */
  public interface BrowserQuery
  {
  
      /**
       * This method returns the query to be executed to get the results which will
       * be opened in the browser.
       *
       */
      public String getQueryString(PortletRequest request, Context context);
  
      /**
       * Filter the row programmatically on a query.
       * By returning true, instruct the database browser to filter the row.
       * By returning false, instruct the database browser to keep the row.
       * (Filtering means removing the row from the final result set).
       *
       * @param row The row being inspected for filtration.
       * @return True to filter the row, false to keep it.
       */
      public boolean filter(List row, PortletRequest request);
  
      /*
       * Set a list of JDBC query parameters.
       * All members of this list must be java objects (not primitives)
       * Should be called from derived classes.
       *
       */
      public void setSQLParameters(List parameters);
  
      public List getSQLParameters();
  
  
  }
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/AbstractBrowserPortlet.java
  
  Index: AbstractBrowserPortlet.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  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;
  import java.sql.SQLException;
  import java.sql.Types;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  import java.util.Vector;
  
  import javax.portlet.ActionRequest;
  import javax.portlet.ActionResponse;
  import javax.portlet.PortletException;
  import javax.portlet.PortletMode;
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletPreferences;
  import javax.portlet.PortletRequest;
  import javax.portlet.PortletSession;
  import javax.portlet.RenderRequest;
  import javax.portlet.RenderResponse;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
  import org.apache.velocity.context.Context;
  
  /**
   * AbstractBrowserPortlet
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: AbstractBrowserPortlet.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   */
  public abstract class AbstractBrowserPortlet 
      extends GenericVelocityPortlet
      implements Browser    
  {
      protected static final String SQL = "sql";
  
      protected static final String POOLNAME = "poolname";
  
      protected static final String START = "start";
  
      protected static final String CUSTOMIZE_TEMPLATE = "customizeTemplate";
  
      protected static final String WINDOW_SIZE = "windowSize";
  
      protected static final String USER_OBJECT_NAMES = "user-object-names";
  
      protected static final String USER_OBJECT_TYPES = "user-object-types";
  
      protected static final String USER_OBJECTS = "user-objects";
  
      protected static final String SQL_PARAM_PREFIX = "sqlparam";
  
      protected static final String LINKS_READ = "linksRead";
  
      protected static final String ROW_LINK = "rowLinks";
  
      protected static final String TABLE_LINK = "tableLinks";
  
      protected static final String ROW_LINK_IDS = "row-link-ids";
  
      protected static final String ROW_LINK_TYPES = "row-link-types";
  
      protected static final String ROW_LINK_TARGETS = "row-link-targets";
  
      protected static final String TABLE_LINK_IDS = "table-link-ids";
  
      protected static final String TABLE_LINK_TYPES = "table-link-types";
  
      protected static final String TABLE_LINK_TARGETS = "table-link-targets";
  
      protected static final String BROWSER_TABLE_SIZE = "tableSize";
  
      protected static final String BROWSER_ACTION_KEY = "browser_action_key";
  
      protected static final String BROWSER_ITERATOR = "table";
  
      protected static final String BROWSER_TITLE_ITERATOR = "title";
  
      protected static final String NEXT = "next";
  
      protected static final String PREVIOUS = "prev";
  
      protected static final String VELOCITY_NULL_ENTRY = "-";
  
      // portlet entry Id
      protected static final String PEID = "js_peid";
  
      protected static final String SORT_COLUMN_NAME = "js_dbcolumn";
  
      protected List sqlParameters = new Vector();
  
      /**
       * Static initialization of the logger for this class
       */
      protected Log log = LogFactory.getLog(AbstractBrowserPortlet.class);
  
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);       
      }
      
      public void doView(RenderRequest request, RenderResponse response)
              throws PortletException, IOException
      {
          int resultSetSize, next, prev, windowSize;
  
          response.setContentType("text/html");
          
          BrowserIterator iterator = getBrowserIterator(request);
          Context context = this.getContext(request);
  
          String sortColName = request.getParameter(SORT_COLUMN_NAME);
          int start = getStartVariable(request, START, sortColName, iterator);
          PortletPreferences prefs = request.getPreferences();
  
          windowSize = Integer.parseInt(prefs.getValue(WINDOW_SIZE, "10"));
          next = start + windowSize;
          prev = start - windowSize;
  
          try
          {
              if (iterator == null)
              {
                  String sql = getQueryString(request, context);
                  //System.out.println("buildNormalContext SQL: "+sql);
                  if (sql != null)
                  {
                      readUserParameters(request, context);
                      getRows(request, sql, windowSize);
                      iterator = getBrowserIterator(request);
                  } else
                  {
                      log
                              .info("The sql query is null, hence not generating the result set.");
                  }
              } else
              {
                  if (sortColName != null)
                  {
                      iterator.sort(sortColName);
                  }
                  iterator.setTop(start);
              }
  
              readLinkParameters(request, context);
  
              if (iterator != null)
              {
                  resultSetSize = iterator.getResultSetSize();
  
                  if (next < resultSetSize)
                  {
                      context.put(NEXT, String.valueOf(next));
                  }
                  if (prev <= resultSetSize && prev >= 0)
                  {
                      context.put(PREVIOUS, String.valueOf(prev));
                  }
  
                  context.put(BROWSER_ITERATOR, iterator);
                  context.put(BROWSER_TITLE_ITERATOR, iterator
                          .getResultSetTitleList());
                  context.put(BROWSER_TABLE_SIZE, new Integer(resultSetSize));
  
                  /*
                   * System.out.println("buildNormalContext Sort column name=
                   * "+sortColName); System.out.println("buildNormalContext
                   * Iterator: "+iterator); System.out.println("buildNormalContext
                   * Titles= "+iterator.getResultSetTitleList());
                   * System.out.println("buildNormalContext
                   * windowSize="+windowSize+" prev="+prev+ " next="+next+"
                   * start="+start+" resultSetSize="+resultSetSize);
                   */
              }
  
          } catch (Exception e)
          {
              // log the error msg
              log.error("Exception", e);
  
              /*
               * TODO: error logging
               * 
               * rundata.setMessage("Error in Portals Gems Browser: " +
               * e.toString()); rundata.setStackTrace(StringUtils.stackTrace(e),
               * e);
               * rundata.setScreenTemplate(JetspeedResources.getString("template.error","Error"));
               */
          }
  
          super.doView(request, response);
      }
  
      public void doEdit(RenderRequest request, RenderResponse response)
              throws PortletException, IOException
      {
          response.setContentType("text/html");
          doPreferencesEdit(request, response);
      }
      
      public void processAction(ActionRequest request, ActionResponse response) 
      throws PortletException, IOException
      {
          if (request.getPortletMode() == PortletMode.EDIT)
          {
              processPreferencesAction(request, response);
          }
          else
          {
              String browserAction = request.getParameter("db.browser.action");
              if (browserAction != null)
              {
                  if (browserAction.equals("refresh"))
                  {
                      clearBrowserIterator(request);                    
                  }
                  String start = request.getParameter("start");
                  if (start != null)
                  {
                      response.setRenderParameter("start", start);
                  }
              }
          }        
      }
      
      /**
       * Centralizes the calls to session - to retrieve the
       * BrowserIterator.
       * 
       * @param data
       *            The turbine rundata context for this request.
       *  
       */
      protected BrowserIterator getBrowserIterator(PortletRequest request)
      {
          BrowserIterator iterator = (BrowserIterator) request
                  .getPortletSession().getAttribute(BROWSER_ACTION_KEY,
                          PortletSession.PORTLET_SCOPE);
          return iterator;
      }
  
      /**
       * Centralizes the calls to session - to set
       * the BrowserIterator.
       *
       * @param data The turbine rundata context for this request.
       * @param iterator.
       *
       */
      protected void setBrowserIterator(RenderRequest request,
                                                BrowserIterator iterator)
      {
          request.getPortletSession().setAttribute(BROWSER_ACTION_KEY, iterator);
      }
      
      /**
       * Centralizes the calls to session - to clear
       * the BrowserIterator from the temp storage.
       *
       * @param data The turbine rundata context for this request.
       *
       */
      protected void clearBrowserIterator(PortletRequest request)
      {
          request.getPortletSession().removeAttribute(BROWSER_ACTION_KEY);
      }
      
      protected int getStartVariable(RenderRequest request, String attrName,
              String sortColName, BrowserIterator iterator)
      {
          int start = -1;
          // if users want to overwrite how the sorting affects the cursor for
          // the window
          if (sortColName != null) start = getStartIndex();
  
          if (start < 0)
          {
              //fallback routine for start
              String startStr = request.getParameter(attrName);
              if (startStr != null && startStr.length() > 0)
              {
                  start = Integer.parseInt(startStr);
              } else if (start == -1 && iterator != null)
              {
                  start = iterator.getTop();
              }
  
              if (start < 0) start = 0;
          }
          return start;
      }
  
      /**
       * to be used if sorting behavior to be overwritten
       */
      protected int getStartIndex()
      {
          return 0;
      }
   
      /**
       * This method returns the sql from the getQuery method which can be
       * overwritten according to the needs of the application. If the getQuery()
       * returns null, then it gets the value from the psml file. If the psml
       * value is null then it returns the value from the xreg file.
       *  
       */
      protected String getQueryString(RenderRequest request, Context context)
      {
          String sql = getQueryString(request);
          if (null == sql)
          {
              sql = getPreference(request, SQL, null);
          }
          return sql;
      }
      
      public String getQueryString(RenderRequest request)
      {
          return null;
      }
  
      protected String getPreference(RenderRequest request,
              String attrName, String attrDefValue)
      {        
          return request.getPreferences().getValue(attrName, attrDefValue);
      }
  
      protected void readUserParameters(RenderRequest request, Context context)
      {
          List userObjectList;
          Object userObjRead = request.getPortletSession().getAttribute(
                  USER_OBJECTS, PortletSession.PORTLET_SCOPE);
          if (userObjRead != null)
          {
              context.put(USER_OBJECTS, (List) userObjRead);
              //System.out.println("userObjectListSize: "+
              // ((List)userObjRead).size());
          } else
          {
              /*
               * TODO: implement user parameters
               * 
               * String userObjTypes=
               * getParameterFromRegistry(portlet,USER_OBJECT_TYPES,null); String
               * userObjNames=
               * getParameterFromRegistry(portlet,USER_OBJECT_NAMES,null); if(
               * userObjTypes != null && userObjTypes.length() > 0 ) {
               * userObjectList = new ArrayList(); int userObjectIndex = 0;
               * StringTokenizer tokenizer1 = new StringTokenizer(userObjNames,
               * ","); StringTokenizer tokenizer3 = new
               * StringTokenizer(userObjTypes, ",");
               * while(tokenizer1.hasMoreTokens() && tokenizer3.hasMoreTokens()) {
               * userObjectList.add(userObjectIndex, new
               * ActionParameter(tokenizer1.nextToken(), null,
               * tokenizer3.nextToken())); userObjectIndex++; }
               * context.put(USER_OBJECTS, userObjectList);
               * setParameterToTemp(portlet, rundata, USER_OBJECTS,
               * userObjectList); //System.out.println("readLink:
               * userObjectTypesListSize: "+userObjectList.size()); }
               */
          }
      }
  
      protected void readSqlParameters(RenderRequest request)
      {
          List sqlParamList = null;
  
          int i = 1;
          while (true)
          {
              String param = getPreference(request, SQL_PARAM_PREFIX + i, null);
              if (param == null)
              {
                  break;
              }
              else
              {
                  if (sqlParamList == null)
                  {
                      sqlParamList = new ArrayList();
                  }
                  sqlParamList.add(param);
              }
              i++;
          }
  
          if (sqlParamList != null)
          {
              setSQLParameters(sqlParamList);
          }
      }
  
      public void setSQLParameters(List parameters)
      {
          this.sqlParameters = parameters;
      }
      
      protected void readLinkParameters(RenderRequest request, Context context)
      {
          // TODO: implement me
      }
  
      /**
       * This method should be overwritten every time the user object needs to be
       * populated with some user specific constraints. As an example if the user wanted
       * to track the parent of an object based on some calculation per row, it could be
       * done here.
       *
       */
      public void populate(int rowIndex, int columnIndex, List row)
      {
      }
  
      /* (non-Javadoc)
       * @see org.apache.jetspeed.modules.actions.portlets.browser.BrowserQuery#filter(java.util.List, RunData)
       */
      public boolean filter(List row, RenderRequest request)
      {
          return false;
      }
      
  }
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/DatabaseBrowserIterator.java
  
  Index: DatabaseBrowserIterator.java
  ===================================================================
  /*
   * Copyright 2000-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.portals.gems.browser;
  
  import java.util.List;
  import java.util.Collections;
  import java.sql.Types;
  
  import org.apache.commons.logging.Log;
  import org.apache.commons.logging.LogFactory;
  
  /**
   * A class for iterating over the window. The window constitutes the selection
   * of rows being displayed to the user from the List storing all the ResultSet.
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor </a>
   * @version $Id: DatabaseBrowserIterator.java,v 1.1 2004/12/31 23:59:09 taylor Exp $
   */
  public class DatabaseBrowserIterator implements BrowserIterator
  {
  
      /**
       * Static initialization of the logger for this class
       */
      transient protected Log log = LogFactory.getLog(DatabaseBrowserIterator.class);
  
      private static final String VELOCITY_NULL_ENTRY = "-";
  
      int top = 0;
  
      int index = 0;
  
      int bottom = -1;
  
      int windowSize = -1;
  
      int rsListSize = -1;
  
      boolean ascendingOrder = true;
  
      String sortColumnName = null;
  
      List rsList;
  
      List rsTitleList;
  
      List rsTypeList;
  
      /**
       * Constructor for the database browser iterator
       * 
       * @param result
       *            The List containg all the rows from the resultSet.
       * @param columnTitles
       *            The List containg all the columnLabels from a resultSet.
       * @param pageSize
       *            The number of rows to be displayed in a window configured by
       *            the user.
       */
      public DatabaseBrowserIterator(List result, List columnTitles,
              List columnTypes, int pageSize)
      {
          this.rsList = result;
          this.rsTitleList = columnTitles;
          this.rsTypeList = columnTypes;
          this.windowSize = pageSize;
          this.rsListSize = result.size();
          setBottom();
      }
  
      /**
       * This method returns the result set.
       *  
       */
      public List getResultSet()
      {
          return rsList;
      }
  
      /**
       * This method returns the number of rows in the result set.
       *  
       */
      public int getResultSetSize()
      {
          return rsListSize;
      }
  
      /**
       * This method returns the List containg the column labels of the result
       * set.
       *  
       */
      public List getResultSetTitleList()
      {
          return rsTitleList;
      }
  
      /**
       * This method returns the List containg the column type names of the result
       * set.
       * 
       * @see java.sql.Types
       */
      public List getResultSetTypesList()
      {
          return rsTypeList;
      }
  
      /**
       * This method returns the index of the row to which the cursor is pointing
       * at.
       *  
       */
      public int getTop()
      {
          return top;
      }
  
      /**
       * This method points the cursor to the index provided.
       * 
       * @param start
       *            Index to which cursor should point to
       */
      public void setTop(int start)
      {
          top = start;
          index = top;
          setBottom();
      }
  
      /**
       * This method returns the last index of the row in the window displayed.
       *  
       */
      public int getBottom()
      {
          return bottom;
      }
  
      /**
       * This method returns the window size.
       *  
       */
      public int getWindowSize()
      {
          return windowSize;
      }
  
      /**
       * This method sets the bottom based on which index the cursor points to and
       * the size of the result set.
       *  
       */
      private void setBottom()
      {
          bottom = top + windowSize;
          if (bottom > rsListSize)
          {
              bottom = rsListSize;
          }
      }
  
      /**
       * Returns true if the iteration has more elements
       */
      public boolean hasNext()
      {
          if (index <= rsListSize && index < bottom) { return true; }
          return false;
      }
  
      /**
       * Returns the next element in the iteration
       */
      public Object next()
      {
          index = index + 1;
          return rsList.get(index - 1);
      }
  
      /**
       * Logs as info - since remove operation is not supported by this Iterator.
       */
      public void remove()
      {
          log.info("The remove operation is not supported.");
      }
  
      /**
       * This method sorts the result set according to the value of the column as
       * specified by the parameter column name. Changes the order of the result
       * set vector.
       * 
       * @param String
       *            sortColumnName
       */
      public void sort(String columnName)
      {
          //System.out.println("current columnName="+columnName);
          //System.out.println("old columnName="+sortColumnName);
          if (columnName != null)
          {
              if (sortColumnName != null && sortColumnName.equals(columnName))
              {
                  ascendingOrder = !ascendingOrder;
              } else
              {
                  ascendingOrder = true;
                  sortColumnName = columnName;
              }
              Collections.sort(rsList, this);
          }
      }
  
      /*
       * Compares its two arguments for order.
       *  
       */
      public int compare(Object obj1, Object obj2)
      {
          int idx = rsTitleList.indexOf(sortColumnName);
          int order = 0;
  
          if (idx != -1)
          {
              Object col1 = ((List) obj1).get(idx);
              Object col2 = ((List) obj2).get(idx);
  
              if ((col1).equals(VELOCITY_NULL_ENTRY))
              {
                  if ((col2).equals(VELOCITY_NULL_ENTRY))
                  {
                      order = 0;
                  } else
                  {
                      order = -1;
                  }
              } else if ((col2).equals(VELOCITY_NULL_ENTRY))
              {
                  order = 1;
              } else
              {
                  int type = Integer.parseInt((String) rsTypeList.get(idx));
                  switch (type)
                  {
  
                  case Types.NUMERIC:
                      order = (((java.math.BigDecimal) col1)
                              .compareTo((java.math.BigDecimal) col2));
                      break;
  
                  case Types.DECIMAL:
                      order = (((java.math.BigDecimal) col1)
                              .compareTo((java.math.BigDecimal) col2));
                      break;
  
                  case Types.TINYINT:
                      order = (((Byte) col1).compareTo((Byte) col2));
                      break;
  
                  case Types.SMALLINT:
                      order = (((Short) col1).compareTo((Short) col2));
                      break;
  
                  case Types.INTEGER:
                      order = (((Integer) col1).compareTo((Integer) col2));
                      break;
  
                  case Types.BIGINT:
                      order = (((Long) col1).compareTo((Long) col2));
                      break;
  
                  case Types.REAL:
                      order = (((Float) col1).compareTo((Float) col2));
                      break;
  
                  case Types.FLOAT:
                      order = (((Double) col1).compareTo((Double) col2));
                      break;
  
                  case Types.DOUBLE:
                      order = (((Double) col1).compareTo((Double) col2));
                      break;
  
                  case Types.DATE:
                      order = (((java.sql.Date) col1)
                              .compareTo((java.sql.Date) col2));
                      break;
  
                  case Types.TIME:
                      order = (((java.sql.Time) col1)
                              .compareTo((java.sql.Time) col2));
                      break;
  
                  case Types.TIMESTAMP:
                      order = (((java.sql.Timestamp) col1)
                              .compareTo((java.sql.Timestamp) col2));
                      break;
  
                  case Types.CHAR:
                      order = (((String) col1).compareTo((String) col2));
                      break;
  
                  case Types.VARCHAR:
                      order = (((String) col1).compareTo((String) col2));
                      break;
  
                  case Types.LONGVARCHAR:
                      order = (((String) col1).compareTo((String) col2));
                      break;
  
                  default:
                      log
                              .info("DatabaseBrowserIterator.compare DataType mapping not found"
                                      + " in DatabaseBrowserIterator. "
                                      + "Hence cannot sort based on provided column.");
                      break;
                  }
              }
          }
          //System.out.println("index of type= "+idx +", order= "+order+",
          // ascending= "+ascendingOrder);
          if (!ascendingOrder)
          {
              order = 0 - order;
          }
          return order;
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!DOCTYPE project [
    <!ENTITY % locator-entities SYSTEM "file:locator.ent"> %locator-entities;	
  ]>
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <project>
    <extend>${basedir}/../../project.xml</extend>
    <pomVersion>3</pomVersion>
    <id>portals-gems</id>
    <groupId>portals-gems</groupId>
    <name>Apache Portals Gems</name>
    
    <package>org.apache.portals.gems</package>
    <description>
  	  Reusable Portlets (Gems) for your Portlet Applications
    </description>
    <shortDescription>Reusable Portlet Gems</shortDescription>
  
    <repository>
      <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-jetspeed-2/applications/gems</connection>
      <url>http://cvs.apache.org/viewcvs/jakarta-jetspeed-2/applications/gems/</url>
    </repository>
  
    <dependencies>    		    
        <dependency>
        <id>junit</id>
        <version>3.8.1</version>
      </dependency>    
      <dependency>
        <id>commons-pool</id>
        <version>1.2</version>
      </dependency>
      <dependency>
        <id>commons-dbcp</id>
        <version>1.2.1</version>
      </dependency>
      <dependency>
          <groupId>portlet-api</groupId>
          <artifactId>portlet-api</artifactId>
          <version>1.0</version>
          <type>jar</type>
      </dependency>
      <dependency>
          <groupId>portals-bridges</groupId>
          <artifactId>portals-bridges-common</artifactId>
          <version>0.1</version>
          <type>jar</type>
      </dependency>
      <dependency>
          <groupId>portals-bridges</groupId>
          <artifactId>portals-bridges-velocity</artifactId>
          <version>0.1</version>
          <type>jar</type>
      </dependency>        
      <dependency>
        <id>velocity</id>
        <version>1.4</version>
      </dependency>    
    </dependencies>
    <build>
      <sourceDirectory>src/java</sourceDirectory>
      <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
      <unitTest>
        <includes>
          <include>**/Test*.java</include>
        </includes>
  
        <resources>
          <resource>
            <directory>${basedir}/src/test</directory>
            <excludes>
             <exclude>**/*.java</exclude>
            </excludes>
          </resource>
          <resource>
            <directory>${basedir}/src/java</directory>
            <excludes>
             <exclude>**/*.java</exclude>
            </excludes>
          </resource>
        </resources>
      </unitTest>
  
      <resources>
        <resource>
          <directory>${basedir}/src/java</directory>
          <excludes>
            <exclude>**/*.java</exclude>
          </excludes>
        </resource>
      </resources>
  
    </build>
    <reports>
    
    	&j2-reports;
    
    </reports>  
  </project>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/project.properties
  
  Index: project.properties
  ===================================================================
  # Copyright 2004 The Apache Software Foundation
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # $Id: project.properties,v 1.1 2004/12/31 23:59:09 taylor Exp $
  #
  
  maven.multiproject.type=jar
  maven.license.licenseFile=${basedir}/../../LICENSE.TXT
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/locator.ent
  
  Index: locator.ent
  ===================================================================
  <!-- Project dependencies -->
  
  <!-- Project reports -->
  <!ENTITY j2-reports SYSTEM "file:../../etc/project-reports/j2-reports.xml">
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/maven.xml
  
  Index: maven.xml
  ===================================================================
  <!--
  Copyright 2004 The Apache Software Foundation
  
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
      http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  -->
  <project default="java:jar"
           xmlns:j="jelly:core"
           xmlns:define="jelly:define"
           xmlns:maven="jelly:maven">
  
    <!-- Target of maven test:single test -->
    <property name='testcase' value='org.apache.jetspeed.sso.TestSSOComponent'/>
  
   
    <goal name="deployJar">
    	<attainGoal name="jar:install"/>
    	<copy file="${basedir}/target/${maven.final.name}.jar" todir="${org.apache.jetspeed.deploy.war.dir}/jetspeed/WEB-INF/lib"/>
    </goal>
  
  
  </project>
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  target
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser.properties
  
  Index: Browser.properties
  ===================================================================
  javax.portlet.title = Database Browser
  javax.portlet.short-title = DB
  javax.portlet.keywords = database, sql
  name = Name
  url = URL
  add = Add
  delete = Delete
  cancel = Cancel
  help.title = Help Mode
  help.text = The Database Browser portlet provides a browser of SQL databases.
  dbnext = Next
  dbprev = Previous
  dbrefresh = Refresh
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_en.properties
  
  Index: Browser_en.properties
  ===================================================================
  javax.portlet.title = Database Browser
  javax.portlet.short-title = DB
  javax.portlet.keywords = database, sql
  name = Name
  url = URL
  add = Add
  delete = Delete
  cancel = Cancel
  help.title = Help Mode
  help.text = The Database Browser portlet provides a browser of SQL databases.
  dbnext = Next
  dbprev = Previous
  dbrefresh = Refresh
  
  
  
  
  1.1                  jakarta-jetspeed-2/applications/gems/src/java/org/apache/portals/gems/browser/resources/Browser_de.properties
  
  Index: Browser_de.properties
  ===================================================================
  javax.portlet.title = Database Browser
  javax.portlet.short-title = DB
  javax.portlet.keywords = database, sql
  name = Name
  url = URL
  add = Hinzufügen
  delete = löschen
  cancel = Abbrechen
  help.title = Help Mode
  help.text = The Database Browser portlet provides a browser of SQL databases.
  dbnext = Weiter
  dbprev = Zuruck
  dbrefresh = Erneuern
    
    
  
  
  1.17      +34 -0     jakarta-jetspeed-2/applications/security/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/applications/security/project.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- project.xml	22 Dec 2004 17:50:10 -0000	1.16
  +++ project.xml	31 Dec 2004 23:59:09 -0000	1.17
  @@ -204,6 +204,40 @@
         </properties>
       </dependency>
       <dependency>
  +        <groupId>portals-gems</groupId>
  +        <artifactId>portals-gems</artifactId>
  +        <version>2.0-M2-dev</version>
  +        <type>jar</type>
  +        <properties>
  +            <war.bundle>true</war.bundle>
  +        </properties>
  +    </dependency>
  +        <dependency>
  +            <groupId>portals-bridges</groupId>
  +            <artifactId>portals-bridges-velocity</artifactId>
  +            <version>0.1</version>
  +            <type>jar</type>
  +            <properties>
  +                <war.bundle>true</war.bundle>
  +            </properties>
  +        </dependency>
  +		<dependency>
  +		  <id>velocity</id>
  +		  <version>1.4</version>
  +		  <properties>
  +			<war.bundle>true</war.bundle>
  +		  </properties>      
  +		</dependency>
  +		<dependency>
  +         <id>velocity-tools</id>
  +         <version>1.1</version>
  +		  <url>http://jakarta.apache.org/velocity</url>
  +		  <properties>
  +			<war.bundle>true</war.bundle>
  +		  </properties>      
  +		</dependency>    
  +    
  +    <dependency>
         <groupId>commons-el</groupId>
         <artifactId>commons-el</artifactId>
         <version>1.0</version>
  
  
  
  1.31      +2 -2      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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- portlet.xml	23 Dec 2004 06:27:42 -0000	1.30
  +++ portlet.xml	31 Dec 2004 23:59:10 -0000	1.31
  @@ -598,7 +598,7 @@
       <description>Database Portlet</description>
       <portlet-name>DatabasePortlet</portlet-name>
       <display-name>Database Portlet</display-name>
  -    <portlet-class>org.apache.portals.applications.database.DatabaseBrowserPortlet</portlet-class>
  +    <portlet-class>org.apache.portals.gems.browser.DatabaseBrowserPortlet</portlet-class>
       <init-param>
   		<name>ViewPage</name>
   			<value>/WEB-INF/view/database-view.vm</value>
  @@ -620,7 +620,7 @@
       </supports>                                
       <supported-locale>en</supported-locale>                
       <supported-locale>de</supported-locale>            
  -    <resource-bundle>org.apache.portals.applications.database.resources.DatabaseBrowser</resource-bundle>            
  +    <resource-bundle>org.apache.portals.gems.browser.resources.Browser</resource-bundle>            
       <portlet-preferences>
         <preference>                            
           <name>windowSize</name>                    
  
  
  
  1.1                  jakarta-jetspeed-2/applications/security/src/java/org/apache/jetspeed/portlets/security/sso/SSOBrowser.java
  
  Index: SSOBrowser.java
  ===================================================================
  /* Copyright 2004 Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
  *     http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
  package org.apache.jetspeed.portlets.security.sso;
  
  import java.sql.Types;
  import java.util.ArrayList;
  import java.util.Iterator;
  import java.util.List;
  
  import javax.portlet.PortletConfig;
  import javax.portlet.PortletException;
  import javax.portlet.RenderRequest;
  
  import org.apache.jetspeed.portlets.security.SecurityResources;
  import org.apache.jetspeed.security.UserManager;
  import org.apache.jetspeed.sso.SSOProvider;
  import org.apache.portals.gems.browser.BrowserIterator;
  import org.apache.portals.gems.browser.DatabaseBrowserIterator;
  import org.apache.portals.gems.browser.AbstractBrowserPortlet;
  
  /**
   * SSOBrowser
   * 
   * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
   * @version $Id: SSOBrowser.java,v 1.1 2004/12/31 23:59:10 taylor Exp $
   */
  public class SSOBrowser extends AbstractBrowserPortlet
  {
      private SSOProvider sso;
      
      public void init(PortletConfig config)
      throws PortletException 
      {
          super.init(config);
          sso = (SSOProvider)getPortletContext().getAttribute(SecurityResources.CPS_SSO_COMPONENT);
          if (null == sso)
          {
              throw new PortletException("Failed to find the SSO Provider on portlet initialization");
          }
      }
      
      public void getRows(RenderRequest request, String sql, int windowSize)
      throws Exception
      {
          List resultSetTitleList = new ArrayList();
          List resultSetTypeList = new ArrayList();
          try
          {
              //
              // get query parameters from registry
              //
  //            Iterator it = sqlParameters.iterator();
  //            int ix = 0;
  //            while (it.hasNext())
  //            {
  //                ix++;
  //                Object object = it.next();
  //            }
  
              //
              // submit the query
              //
              Iterator sites = sso.getSites("");
              
              // List userObjectList = (List)getParameterFromTemp(portlet, rundata, USER_OBJECTS);
  
  
              //
              // Add MetaData headers, types
              //
              
              resultSetTypeList.add(String.valueOf(Types.VARCHAR));
              resultSetTitleList.add("Site");
  
              //
              // add user objects
              //
              //subPopulate(rundata, qResult, repo, folder, null);
  
              // TODO: need to try to normalize List/Collection/Iterators
              List list = new ArrayList();
              while (sites.hasNext())
              {
                  list.add(sites.next());
              }
              BrowserIterator iterator = new DatabaseBrowserIterator(
                      list, resultSetTitleList, resultSetTypeList,
                      windowSize);
              setBrowserIterator(request, iterator);
          }
          catch (Exception e)
          {
              //log.error("Exception in CMSBrowserAction.getRows: ", e);
              e.printStackTrace();
              throw e;
          }        
      }
      
  }
  
  
  
  1.27      +9 -0      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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- project.xml	8 Dec 2004 20:35:04 -0000	1.26
  +++ project.xml	31 Dec 2004 23:59:10 -0000	1.27
  @@ -95,6 +95,15 @@
               </properties>
           </dependency>
           <dependency>
  +            <groupId>portals-gems</groupId>
  +            <artifactId>portals-gems</artifactId>
  +            <version>2.0-M2-dev</version>
  +            <type>jar</type>
  +            <properties>
  +                <war.bundle>true</war.bundle>
  +            </properties>
  +        </dependency>
  +        <dependency>
               <groupId>portals-bridges</groupId>
               <artifactId>portals-bridges-common</artifactId>
               <version>0.1</version>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message