Java Doc for JDBCGroupDatabase.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » auth » authorize » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.auth.authorize 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.auth.authorize.JDBCGroupDatabase

JDBCGroupDatabase
public class JDBCGroupDatabase implements GroupDatabase(Code)

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 are configured via settings in jspwiki.properties.

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
jspwiki.groupdatabase.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"/>
 ...
</Context>

JDBC driver JARs should be added to Tomcat's common/lib directory. For more Tomcat 5.5 JNDI configuration examples, see http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html.

JDBCGroupDatabase commits changes as transactions if the back-end database supports them. If the database supports transactions, group changes are saved to permanent storage only when the JDBCGroupDatabase.commit() method is called. If the database does not support transactions, then changes are made immediately (during the JDBCGroupDatabase.save(Group,Principal) method), and the method no-ops. Thus, callers should always call the method after saving a profile to guarantee that changes are applied.


author:
   Andrew R. Jaquith
since:
   2.3


Field Summary
final public static  StringDEFAULT_GROUPDB_CREATED
     Default column name that stores the the group creation timestamps.
final public static  StringDEFAULT_GROUPDB_CREATOR
     Default column name that stores group creator names.
final public static  StringDEFAULT_GROUPDB_DATASOURCE
     Default column name that stores the JNDI name of the DataSource.
final public static  StringDEFAULT_GROUPDB_MEMBER
     Default column name that stores group member names.
final public static  StringDEFAULT_GROUPDB_MEMBER_TABLE
     Default column name that stores the names of group members.
final public static  StringDEFAULT_GROUPDB_MODIFIED
     Default column name that stores group last-modified timestamps.
final public static  StringDEFAULT_GROUPDB_MODIFIER
     Default column name that stores names of users who last modified groups.
final public static  StringDEFAULT_GROUPDB_NAME
     Default column name that stores the group names.
final public static  StringDEFAULT_GROUPDB_TABLE
     Default table name for the table that stores groups.
final public static  StringPROP_GROUPDB_CREATED
     The column containing the group's creation timestamp.
final public static  StringPROP_GROUPDB_CREATOR
     The column containing the group creator's name.
final public static  StringPROP_GROUPDB_DATASOURCE
     The JNDI name of the DataSource.
final public static  StringPROP_GROUPDB_MEMBER
     The column containing the group member's name.
final public static  StringPROP_GROUPDB_MEMBER_TABLE
     The table that stores the names of group members.
final public static  StringPROP_GROUPDB_MODIFIED
     The column containing the group's last-modified timestamp.
final public static  StringPROP_GROUPDB_MODIFIER
     The column containing the name of the user who last modified the group.
final public static  StringPROP_GROUPDB_NAME
     The column containing the group's name.
final public static  StringPROP_GROUPDB_TABLE
     The table that stores the groups.
final protected static  Loggerlog
    


Method Summary
public  voidcommit()
     No-op method that in previous versions of JSPWiki was intended to atomically commit changes to the user database.
public  voiddelete(Group group)
     Looks up and deletes a Group from the group database.
public  Group[]groups()
     Returns all wiki groups that are stored in the GroupDatabase as an array of Group objects.
public  voidinitialize(WikiEngine engine, Properties props)
     Initializes the group database based on values from a Properties object.
public  voidsave(Group group, Principal modifier)
     Saves a Group to the group database.

Field Detail
DEFAULT_GROUPDB_CREATED
final public static String DEFAULT_GROUPDB_CREATED(Code)
Default column name that stores the the group creation timestamps.



DEFAULT_GROUPDB_CREATOR
final public static String DEFAULT_GROUPDB_CREATOR(Code)
Default column name that stores group creator names.



DEFAULT_GROUPDB_DATASOURCE
final public static String DEFAULT_GROUPDB_DATASOURCE(Code)
Default column name that stores the JNDI name of the DataSource.



DEFAULT_GROUPDB_MEMBER
final public static String DEFAULT_GROUPDB_MEMBER(Code)
Default column name that stores group member names.



DEFAULT_GROUPDB_MEMBER_TABLE
final public static String DEFAULT_GROUPDB_MEMBER_TABLE(Code)
Default column name that stores the names of group members.



DEFAULT_GROUPDB_MODIFIED
final public static String DEFAULT_GROUPDB_MODIFIED(Code)
Default column name that stores group last-modified timestamps.



DEFAULT_GROUPDB_MODIFIER
final public static String DEFAULT_GROUPDB_MODIFIER(Code)
Default column name that stores names of users who last modified groups.



DEFAULT_GROUPDB_NAME
final public static String DEFAULT_GROUPDB_NAME(Code)
Default column name that stores the group names.



DEFAULT_GROUPDB_TABLE
final public static String DEFAULT_GROUPDB_TABLE(Code)
Default table name for the table that stores groups.



PROP_GROUPDB_CREATED
final public static String PROP_GROUPDB_CREATED(Code)
The column containing the group's creation timestamp.



PROP_GROUPDB_CREATOR
final public static String PROP_GROUPDB_CREATOR(Code)
The column containing the group creator's name.



PROP_GROUPDB_DATASOURCE
final public static String PROP_GROUPDB_DATASOURCE(Code)
The JNDI name of the DataSource.



PROP_GROUPDB_MEMBER
final public static String PROP_GROUPDB_MEMBER(Code)
The column containing the group member's name.



PROP_GROUPDB_MEMBER_TABLE
final public static String PROP_GROUPDB_MEMBER_TABLE(Code)
The table that stores the names of group members.



PROP_GROUPDB_MODIFIED
final public static String PROP_GROUPDB_MODIFIED(Code)
The column containing the group's last-modified timestamp.



PROP_GROUPDB_MODIFIER
final public static String PROP_GROUPDB_MODIFIER(Code)
The column containing the name of the user who last modified the group.



PROP_GROUPDB_NAME
final public static String PROP_GROUPDB_NAME(Code)
The column containing the group's name.



PROP_GROUPDB_TABLE
final public static String PROP_GROUPDB_TABLE(Code)
The table that stores the groups.



log
final protected static Logger log(Code)





Method Detail
commit
public void commit() throws WikiSecurityException(Code)
No-op method that in previous versions of JSPWiki was intended to atomically commit changes to the user database. Now, the JDBCGroupDatabase.save(Group,Principal) and JDBCGroupDatabase.delete(Group) methods are atomic themselves.
throws:
  WikiSecurityException - never...



delete
public void delete(Group group) throws WikiSecurityException(Code)
Looks up and deletes a Group from the group database. If the group database does not contain the supplied Group. this method throws a NoSuchPrincipalException . The method commits the results of the delete to persistent storage.
Parameters:
  group - the group to remove
throws:
  WikiSecurityException - if the database does not contain thesupplied group (thrown as NoSuchPrincipalException) or ifthe commit did not succeed



groups
public Group[] groups() throws WikiSecurityException(Code)
Returns all wiki groups that are stored in the GroupDatabase as an array of Group objects. If the database does not contain any groups, this method will return a zero-length array. This method causes back-end storage to load the entire set of group; thus, it should be called infrequently (e.g., at initialization time). the wiki groups
throws:
  WikiSecurityException - if the groups cannot be returned by the back-end



initialize
public void initialize(WikiEngine engine, Properties props) throws NoRequiredPropertyException, WikiSecurityException(Code)
Initializes the group database based on values from a Properties object.
Parameters:
  engine - the wiki engine
Parameters:
  props - the properties used to initialize the group database
throws:
  WikiSecurityException - if the database could not be initialized successfully
throws:
  NoRequiredPropertyException - if a required property is not present



save
public void save(Group group, Principal modifier) throws WikiSecurityException(Code)
Saves a Group to the group database. Note that this method must fail, and throw an IllegalArgumentException, if the proposed group is the same name as one of the built-in Roles: e.g., Admin, Authenticated, etc. The database is responsible for setting create/modify timestamps, upon a successful save, to the Group. The method commits the results of the delete to persistent storage.
Parameters:
  group - the Group to save
Parameters:
  modifier - the user who saved the Group
throws:
  WikiSecurityException - if the Group could not be saved successfully



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.