Class JDBCGroupDatabase

  • All Implemented Interfaces:

    public class JDBCGroupDatabase
    extends java.lang.Object
    implements GroupDatabase

    Implementation of GroupDatabase that persists Group objects to a JDBC DataSource, as might typically be provided by a web container. This implementation looks up the JDBC DataSource using JNDI. The JNDI name of the datasource, backing table and mapped columns used by this class can be overridden by adding settings in

    Configurable properties are these:

    Property Default Definition
    jspwiki.groupdatabase.datasource jdbc/GroupDatabase The JNDI name of the DataSource
    jspwiki.groupdatabase.table groups The table that stores the groups
    jspwiki.groupdatabase.membertable group_members The table that stores the names of group members
    jspwiki.groupdatabase.created created The column containing the group's creation timestamp
    jspwiki.groupdatabase.creator creator The column containing the group creator's name name The column containing the group's name
    jspwiki.groupdatabase.member member The column containing the group member's name
    jspwiki.groupdatabase.modified modified The column containing the group's last-modified timestamp
    jspwiki.groupdatabase.modifier modifier The column containing the name of the user who last modified the group

    This class is typically used in conjunction with a web container's JNDI resource factory. For example, Tomcat versions 4 and higher provide a basic JNDI factory for registering DataSources. To give JSPWiki access to the JNDI resource named by jdbc/GroupDatabase, you would declare the datasource resource similar to this:

    <Context ...>
      <Resource name="jdbc/GroupDatabase" auth="Container"
        type="javax.sql.DataSource" username="dbusername" password="dbpassword"
        driverClassName="org.hsql.jdbcDriver" url="jdbc:HypersonicSQL:database"
        maxActive="8" maxIdle="4"/>

    JDBC driver JARs should be added to Tomcat's common/lib directory. For more Tomcat 5.5 JNDI configuration examples, see

    JDBCGroupDatabase commits changes as transactions if the back-end database supports them. Changes are made immediately (during the save(Group, Principal) method).

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete​(Group group)
      Looks up and deletes a Group from the group database.
      Group[] groups()
      Returns all wiki groups that are stored in the GroupDatabase as an array of Group objects.
      void initialize​(Engine engine, java.util.Properties props)
      Initializes the group database based on values from a Properties object.
      void save​(Group group, modifier)
      Saves a Group to the group database.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait